/* RBZ Premium Document Management Library Frontend Styles */

.rbz-dml-container {
    margin: 30px 0;
    width: 100%;
}

/* Category Tabs */
.rbz-dml-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 30px;
    padding-bottom: 0;
    border-bottom: none;
}

.rbz-dml-tab {
    padding: 12px 20px;
    background: #FFD700; /* Yellow background */
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    color: #000; /* Dark text */
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.rbz-dml-tab:hover {
    background: #FFC700; /* Slightly darker yellow on hover */
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.rbz-dml-tab.active {
    background: #FFD700; /* Keep yellow when active */
    color: #000; /* Keep dark text */
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    font-weight: 700;
}

.rbz-dml-tab-parent {
    position: relative;
}

.rbz-dml-tab-arrow {
    margin-left: 8px;
    font-size: 10px;
    transition: transform 0.3s ease;
    display: inline-block;
}

.rbz-dml-tab-parent.active .rbz-dml-tab-arrow {
    transform: rotate(180deg);
}

.rbz-dml-subcategory-group {
    width: 100%;
    margin-top: 10px;
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    display: none !important;
    flex-wrap: wrap;
    gap: 12px;
    flex-direction: row;
    visibility: hidden !important;
    opacity: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    transition: opacity 0.3s ease, max-height 0.3s ease;
    position: relative;
}

/* Force hide by default - override any inline styles */
.rbz-dml-subcategory-group:not(.rbz-dml-subcategory-visible) {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Only show when explicitly marked as visible */
.rbz-dml-subcategory-group.rbz-dml-subcategory-visible,
.rbz-dml-subcategory-group[style*="flex"]:not([style*="display: none"]),
.rbz-dml-subcategory-group[data-visible="true"] {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    max-height: 500px !important;
    height: auto !important;
    margin-top: 10px !important;
    overflow: visible !important;
}

.rbz-dml-tab-subcategory {
    margin-left: 0;
    margin-bottom: 0;
    font-size: 13px;
    padding: 10px 20px;
    background: #FFE44D; /* Lighter yellow for subcategories */
    border: none;
    border-left: 3px solid #c78124;
    display: inline-block;
    width: auto;
    text-align: left;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.rbz-dml-tab-subcategory:hover {
    background: #FFD700;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.rbz-dml-tab-subcategory.active {
    background: #FFD700;
    color: #000;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

/* View Toggle */
.rbz-dml-view-toggle {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 25px;
}

.rbz-dml-view-btn {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
}

.rbz-dml-view-btn .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    line-height: 20px;
}

.rbz-dml-view-btn:hover {
    background: #e8e8e8;
    border-color: #c78124;
    color: #071448;
}

.rbz-dml-view-btn.active {
    background: #071448;
    border-color: #071448;
    color: #ffffff;
}

/* Content Views */
.rbz-dml-content {
    position: relative;
}

.rbz-dml-grid-view,
.rbz-dml-list-view {
    display: none;
}

.rbz-dml-grid-view.active,
.rbz-dml-list-view.active {
    display: block;
}

/* Grid View - Matching Monetary Policy Statements Design */
.rbz-dml-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin-bottom: 40px;
}

.rbz-dml-container[data-columns="1"] .rbz-dml-grid {
    grid-template-columns: 1fr;
}

.rbz-dml-container[data-columns="2"] .rbz-dml-grid {
    grid-template-columns: repeat(2, 1fr);
}

.rbz-dml-container[data-columns="3"] .rbz-dml-grid {
    grid-template-columns: repeat(3, 1fr);
}

.rbz-dml-container[data-columns="4"] .rbz-dml-grid {
    grid-template-columns: repeat(4, 1fr);
}

/* Card Styles - Matching Monetary Policy Statements */
.rbz-dml-card {
    background: #f5f5f5;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.rbz-dml-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.rbz-dml-card-header {
    margin-bottom: 20px;
}

.rbz-dml-icon {
    width: 50px;
    height: 50px;
    background: #071448;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.rbz-dml-icon .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
    color: #ffffff;
}

.rbz-dml-title {
    font-size: 18px;
    font-weight: 600;
    color: #071448;
    margin: 0;
    line-height: 1.4;
    margin-bottom: 10px;
}

.rbz-dml-card-body {
    flex: 1;
    margin-bottom: 25px;
}

.rbz-dml-category-badge {
    display: inline-block;
    padding: 6px 12px;
    background: #c78124;
    color: #ffffff;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
}

.rbz-dml-date {
    font-size: 13px;
    color: #666;
    margin-bottom: 15px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rbz-dml-description {
    font-size: 15px;
    line-height: 1.7;
    color: #555;
    margin-bottom: 20px;
}

.rbz-dml-description p {
    margin: 0 0 10px 0;
}

.rbz-dml-description p:last-child {
    margin-bottom: 0;
}

.rbz-dml-card-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: auto;
}

.rbz-dml-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}

/* Button Styles - Matching Monetary Policy Statements */
.rbz-dml-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none !important;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    color: #ffffff;
    line-height: 1.2;
    min-height: 48px;
}

.rbz-dml-btn:hover {
    text-decoration: none !important;
}

.rbz-dml-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    line-height: 18px;
}

.rbz-dml-btn-primary {
    background: linear-gradient(135deg, #c78124 0%, #8b5a1f 100%);
    box-shadow: 0 3px 8px rgba(199, 129, 36, 0.3);
}

.rbz-dml-btn-primary:hover {
    background: linear-gradient(135deg, #d89030 0%, #9b6a2f 100%);
    box-shadow: 0 5px 12px rgba(199, 129, 36, 0.4);
    transform: translateY(-2px);
    color: #ffffff;
}

.rbz-dml-btn-secondary {
    background: #071448;
    box-shadow: 0 3px 8px rgba(7, 20, 72, 0.25);
    color: #ffffff !important;
}

.rbz-dml-btn-secondary:hover {
    background: #0c2066;
    box-shadow: 0 5px 12px rgba(7, 20, 72, 0.35);
    transform: translateY(-2px);
    color: #ffffff !important;
}

.rbz-dml-list-actions .rbz-dml-card-actions {
    grid-template-columns: 1fr 1fr;
    min-width: 280px;
}

/* List View Styles */
.rbz-dml-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.rbz-dml-list-item {
    background: #f5f5f5;
    border-radius: 12px;
    padding: 25px 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 25px;
    border-left: 4px solid #071448;
}

.rbz-dml-list-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-left-color: #c78124;
}

.rbz-dml-list-icon {
    width: 60px;
    height: 60px;
    background: #071448;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rbz-dml-list-icon .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    color: #ffffff;
}

.rbz-dml-list-content {
    flex: 1;
    min-width: 0;
}

.rbz-dml-list-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.rbz-dml-list-title {
    font-size: 17px;
    font-weight: 600;
    color: #071448;
    margin: 0;
    line-height: 1.4;
}

.rbz-dml-list-category {
    display: inline-block;
    padding: 4px 10px;
    background: #c78124;
    color: #ffffff;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rbz-dml-list-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 10px;
}

.rbz-dml-list-date {
    font-size: 13px;
    color: #666;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.rbz-dml-list-date .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #c78124;
}

.rbz-dml-list-description {
    font-size: 14px;
    line-height: 1.6;
    color: #555;
}

.rbz-dml-list-description p {
    margin: 0;
}

.rbz-dml-list-actions {
    flex-shrink: 0;
}

.rbz-dml-list-actions .rbz-dml-btn {
    padding: 12px 20px;
    font-size: 13px;
}

/* Pagination Styles */
.rbz-dml-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
    margin-top: 50px;
    padding: 25px;
    background: #f8f8f8;
    border-radius: 10px;
    border: 2px solid #071448;
}

.rbz-dml-pagination-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: #071448;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rbz-dml-pagination-btn:hover:not(:disabled) {
    background: #c78124;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(7, 20, 72, 0.3);
}

.rbz-dml-pagination-btn:disabled {
    background: #cccccc;
    color: #999999;
    cursor: not-allowed;
    opacity: 0.6;
}

.rbz-dml-pagination-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    line-height: 18px;
}

.rbz-dml-pagination-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: #071448;
}

.rbz-dml-pagination-current {
    font-size: 24px;
    color: #c78124;
    font-weight: 700;
}

.rbz-dml-pagination-total {
    font-size: 20px;
    color: #071448;
    font-weight: 700;
}

.rbz-dml-no-documents {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 18px;
    background: #f8f8f8;
    border-radius: 10px;
    border: 2px dashed #ddd;
}

/* Document Preview Modal */
.rbz-dml-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.rbz-dml-modal.is-open {
    display: flex;
}

.rbz-dml-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 20, 72, 0.72);
    backdrop-filter: blur(4px);
}

.rbz-dml-modal-dialog {
    position: relative;
    z-index: 2;
    width: min(960px, 100%);
    max-height: calc(100vh - 48px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(7, 20, 72, 0.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: rbzDmlModalIn 0.25s ease;
}

@keyframes rbzDmlModalIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.rbz-dml-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 16px;
    border-bottom: 1px solid #eef1f6;
    background: linear-gradient(180deg, #fafbfd 0%, #ffffff 100%);
}

.rbz-dml-modal-title {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 700;
    color: #071448;
    line-height: 1.35;
}

.rbz-dml-modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rbz-dml-modal-category,
.rbz-dml-modal-date {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
}

.rbz-dml-modal-category {
    background: #fff4df;
    color: #8a6d1d;
}

.rbz-dml-modal-date {
    background: #eef2ff;
    color: #071448;
}

.rbz-dml-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: #f3f4f6;
    color: #071448;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.rbz-dml-modal-close:hover {
    background: #071448;
    color: #ffffff;
}

.rbz-dml-modal-close .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.rbz-dml-modal-body {
    padding: 0;
    background: #f3f4f6;
    flex: 1;
    min-height: 0;
}

.rbz-dml-modal-viewer {
    width: 100%;
    height: clamp(420px, 68vh, 760px);
    background: #ffffff;
}

.rbz-dml-modal-iframe {
    display: block;
    width: 100% !important;
    height: 100% !important;
    border: 0 !important;
    background: #ffffff;
}

.rbz-dml-modal-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 280px;
    padding: 40px 24px;
    text-align: center;
    color: #4b5563;
}

.rbz-dml-modal-fallback[hidden] {
    display: none !important;
}

.rbz-dml-modal-fallback-icon {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: #071448;
}

.rbz-dml-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px 22px;
    border-top: 1px solid #eef1f6;
    background: #ffffff;
}

.rbz-dml-modal-footer .rbz-dml-btn {
    width: auto;
    min-width: 160px;
    padding: 12px 18px;
}

body.rbz-dml-modal-open {
    overflow: hidden;
}

/* Hide items beyond first page by default - only if pagination exists */
.rbz-dml-container[data-total] .rbz-dml-pagination ~ .rbz-dml-content .rbz-dml-card:nth-child(n+9),
.rbz-dml-container[data-total] .rbz-dml-pagination ~ .rbz-dml-content .rbz-dml-list-item:nth-child(n+9) {
    /* Let JavaScript handle this */
}

/* Responsive Design */
@media (max-width: 1400px) {
    .rbz-dml-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1200px) {
    .rbz-dml-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .rbz-dml-list-item {
        flex-wrap: wrap;
    }
    
    .rbz-dml-list-actions {
        width: 100%;
    }
    
    .rbz-dml-list-actions .rbz-dml-btn {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .rbz-dml-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }
    
    .rbz-dml-card {
        padding: 25px;
    }
    
    .rbz-dml-tabs {
        flex-direction: column;
    }
    
    .rbz-dml-tab {
        width: 100%;
        text-align: center;
    }
    
    .rbz-dml-view-toggle {
        justify-content: center;
    }
    
    .rbz-dml-pagination {
        flex-direction: column;
        gap: 15px;
    }
    
    .rbz-dml-pagination-btn {
        width: 100%;
        justify-content: center;
    }
    
    .rbz-dml-card-footer {
        gap: 10px;
    }

    .rbz-dml-card-actions {
        grid-template-columns: 1fr;
    }
    
    .rbz-dml-btn {
        width: 100%;
    }

    .rbz-dml-modal {
        padding: 12px;
    }

    .rbz-dml-modal-header,
    .rbz-dml-modal-footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .rbz-dml-modal-footer {
        flex-direction: column;
    }

    .rbz-dml-modal-footer .rbz-dml-btn {
        width: 100%;
        min-width: 0;
    }

    .rbz-dml-modal-viewer {
        height: 55vh;
        min-height: 320px;
    }
    
    .rbz-dml-list-item {
        padding: 20px;
    }
    
    .rbz-dml-list-icon {
        width: 50px;
        height: 50px;
    }
    
    .rbz-dml-list-icon .dashicons {
        font-size: 24px;
        width: 24px;
        height: 24px;
    }
}
