/**
 * PDF Compliance Library Widget Styles
 *
 * @package MMC_Intranet
 * @since 1.0.0
 */

/* ========== CSS VARIABLES (DEFAULTS) ========== */
.mmc-pdf-library {
    --mmc-pdf-primary: #0284c7;
    --mmc-pdf-card-bg: #ffffff;
    --mmc-pdf-border: #e5e7eb;
    --mmc-pdf-title: #1f2937;
    --mmc-pdf-text: #6b7280;
    --mmc-pdf-icon: #dc2626;
    --mmc-pdf-download-bg: #0284c7;
    --mmc-pdf-download-text: #ffffff;
    --mmc-pdf-view-bg: #f3f4f6;
    --mmc-pdf-view-text: #374151;
}

/* ========== CONTAINER ========== */
.mmc-pdf-library {
    padding: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* ========== HEADER ========== */
.mmc-pdf-library-header {
    margin-bottom: 32px;
    text-align: center;
}

.mmc-pdf-library-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--mmc-pdf-title);
    margin: 0 0 12px 0;
    line-height: 1.2;
}

.mmc-pdf-library-description {
    color: var(--mmc-pdf-text);
    font-size: 16px;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ========== CONTROLS ========== */
.mmc-pdf-library-controls {
    display: flex;
    gap: 20px;
    margin-bottom: 32px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}

/* Search Box */
.mmc-pdf-search {
    flex: 1;
    min-width: 280px;
    max-width: 400px;
    position: relative;
}

.mmc-pdf-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--mmc-pdf-text);
    font-size: 18px;
}

.mmc-pdf-search-input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 2px solid var(--mmc-pdf-border);
    border-radius: 12px;
    font-size: 15px;
    color: var(--mmc-pdf-title);
    background: var(--mmc-pdf-card-bg);
    transition: all 0.3s ease;
}

.mmc-pdf-search-input:focus {
    outline: none;
    border-color: var(--mmc-pdf-primary);
    box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.1);
}

.mmc-pdf-search-input::placeholder {
    color: var(--mmc-pdf-text);
    opacity: 0.7;
}

/* Category Filters */
.mmc-pdf-categories {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.mmc-category-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 2px solid var(--mmc-pdf-border);
    background: var(--mmc-pdf-card-bg);
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    color: var(--mmc-pdf-text);
    cursor: pointer;
    transition: all 0.25s ease;
}

.mmc-category-btn:hover {
    border-color: var(--mmc-pdf-primary);
    color: var(--mmc-pdf-primary);
    transform: translateY(-2px);
}

.mmc-category-btn.active {
    background: var(--mmc-pdf-primary);
    color: white;
    border-color: var(--mmc-pdf-primary);
}

.mmc-category-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 11px;
    background: rgba(0, 0, 0, 0.1);
}

.mmc-category-btn.active .mmc-category-count {
    background: rgba(255, 255, 255, 0.25);
}

/* ========== GRID LAYOUT ========== */
.mmc-pdf-grid {
    display: grid;
    gap: 24px;
}

.mmc-pdf-grid[data-columns="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.mmc-pdf-grid[data-columns="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.mmc-pdf-grid[data-columns="4"] {
    grid-template-columns: repeat(4, 1fr);
}

/* List Layout */
.mmc-pdf-grid[data-layout="list"] {
    grid-template-columns: 1fr;
}

.mmc-pdf-grid[data-layout="list"] .mmc-pdf-card-inner {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 24px;
}

.mmc-pdf-grid[data-layout="list"] .mmc-pdf-icon {
    margin-bottom: 0;
    font-size: 36px;
}

.mmc-pdf-grid[data-layout="list"] .mmc-pdf-content {
    flex: 1;
}

.mmc-pdf-grid[data-layout="list"] .mmc-pdf-actions {
    margin-top: 0;
    flex-direction: row;
}

/* Table Layout */
.mmc-pdf-grid[data-layout="table"] {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.mmc-pdf-grid[data-layout="table"] .mmc-pdf-card {
    border-radius: 0;
    border-bottom-width: 1px;
    padding: 16px 20px;
}

.mmc-pdf-grid[data-layout="table"] .mmc-pdf-card:first-child {
    border-radius: 12px 12px 0 0;
}

.mmc-pdf-grid[data-layout="table"] .mmc-pdf-card:last-child {
    border-radius: 0 0 12px 12px;
    border-bottom-width: 2px;
}

.mmc-pdf-grid[data-layout="table"] .mmc-pdf-card-inner {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
}

.mmc-pdf-grid[data-layout="table"] .mmc-pdf-icon {
    margin-bottom: 0;
    font-size: 28px;
}

.mmc-pdf-grid[data-layout="table"] .mmc-pdf-content {
    flex: 1;
}

.mmc-pdf-grid[data-layout="table"] .mmc-pdf-title {
    font-size: 15px;
    margin-bottom: 4px;
}

.mmc-pdf-grid[data-layout="table"] .mmc-pdf-description {
    display: none;
}

.mmc-pdf-grid[data-layout="table"] .mmc-pdf-actions {
    margin-top: 0;
    flex-direction: row;
}

/* ========== CARD STYLES ========== */
.mmc-pdf-card {
    background: var(--mmc-pdf-card-bg);
    border: 2px solid var(--mmc-pdf-border);
    border-radius: 16px;
    padding: 28px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.mmc-pdf-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--mmc-pdf-icon);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mmc-pdf-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    border-color: transparent;
}

.mmc-pdf-card:hover::before {
    opacity: 1;
}

.mmc-pdf-card.hidden {
    display: none;
}

.mmc-pdf-card-inner {
    display: flex;
    flex-direction: column;
}

/* Icon */
.mmc-pdf-icon {
    font-size: 52px;
    color: var(--mmc-pdf-icon);
    margin-bottom: 20px;
    line-height: 1;
}

.mmc-pdf-icon svg {
    width: 52px;
    height: 52px;
}

.mmc-pdf-icon i {
    font-size: 52px;
}

.mmc-pdf-icon .dashicons {
    font-size: 52px;
    width: 52px;
    height: 52px;
}

/* Content */
.mmc-pdf-content {
    flex: 1;
}

/* Title */
.mmc-pdf-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--mmc-pdf-title);
    margin: 0 0 12px 0;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
}

/* Required Badge */
.mmc-required-badge {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: #991b1b;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid #fecaca;
}

/* Description */
.mmc-pdf-description {
    color: var(--mmc-pdf-text);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
}

/* Meta */
.mmc-pdf-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    align-items: center;
}

/* Category Badge */
.mmc-category-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.mmc-category-badge.category-compliance {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1e40af;
}

.mmc-category-badge.category-security {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #991b1b;
}

.mmc-category-badge.category-hr {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #065f46;
}

.mmc-category-badge.category-it {
    background: linear-gradient(135deg, #ffedd5, #fed7aa);
    color: #c2410c;
}

.mmc-category-badge.category-operations {
    background: linear-gradient(135deg, #f3e8ff, #e9d5ff);
    color: #6b21a8;
}

.mmc-category-badge.category-legal {
    background: linear-gradient(135deg, #f5f5f5, #e5e5e5);
    color: #525252;
}

/* Version Badge */
.mmc-version-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

/* Size Badge */
.mmc-size-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

/* Effective Date */
.mmc-pdf-effective-date {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--mmc-pdf-text);
    font-size: 12px;
    margin-bottom: 16px;
}

.mmc-pdf-effective-date .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* ========== ACTIONS ========== */
.mmc-pdf-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.mmc-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.25s ease;
}

.mmc-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.mmc-btn-download {
    background: var(--mmc-pdf-download-bg);
    color: var(--mmc-pdf-download-text);
}

.mmc-btn-download:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
    color: var(--mmc-pdf-download-text);
    text-decoration: none;
}

.mmc-btn-view {
    background: var(--mmc-pdf-view-bg);
    color: var(--mmc-pdf-view-text);
    border: 2px solid var(--mmc-pdf-border);
}

.mmc-btn-view:hover {
    background: #e5e7eb;
    transform: translateY(-2px);
    color: var(--mmc-pdf-view-text);
    text-decoration: none;
}

.mmc-btn-reset {
    background: var(--mmc-pdf-primary);
    color: white;
    margin-top: 16px;
}

.mmc-btn-reset:hover {
    filter: brightness(1.1);
}

/* Pending Upload Button */
.mmc-btn-pending {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    border: 2px dashed #f59e0b;
    cursor: default;
    width: 100%;
}

.mmc-btn-pending .dashicons {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========== EMPTY STATE ========== */
.mmc-pdf-empty {
    text-align: center;
    padding: 60px 20px;
    background: #f9fafb;
    border-radius: 16px;
    border: 2px dashed var(--mmc-pdf-border);
}

.mmc-pdf-empty-icon {
    margin-bottom: 20px;
}

.mmc-pdf-empty-icon .dashicons {
    font-size: 64px;
    width: 64px;
    height: 64px;
    color: var(--mmc-pdf-border);
}

.mmc-pdf-empty h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--mmc-pdf-title);
    margin: 0 0 8px 0;
}

.mmc-pdf-empty p {
    color: var(--mmc-pdf-text);
    margin: 0;
}

/* ========== STATS FOOTER ========== */
.mmc-pdf-stats {
    text-align: center;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--mmc-pdf-border);
}

.mmc-pdf-stats-count {
    color: var(--mmc-pdf-text);
    font-size: 14px;
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mmc-pdf-card {
    animation: fadeIn 0.4s ease forwards;
}

.mmc-pdf-card:nth-child(1) { animation-delay: 0.05s; }
.mmc-pdf-card:nth-child(2) { animation-delay: 0.1s; }
.mmc-pdf-card:nth-child(3) { animation-delay: 0.15s; }
.mmc-pdf-card:nth-child(4) { animation-delay: 0.2s; }
.mmc-pdf-card:nth-child(5) { animation-delay: 0.25s; }
.mmc-pdf-card:nth-child(6) { animation-delay: 0.3s; }

/* ========== RESPONSIVE ========== */
@media (max-width: 1200px) {
    .mmc-pdf-grid[data-columns="4"] {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .mmc-pdf-grid[data-columns="4"],
    .mmc-pdf-grid[data-columns="3"] {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .mmc-pdf-library-header {
        margin-bottom: 24px;
    }

    .mmc-pdf-library-title {
        font-size: 24px;
    }

    .mmc-pdf-library-description {
        font-size: 14px;
    }

    .mmc-pdf-library-controls {
        flex-direction: column;
        gap: 16px;
    }

    .mmc-pdf-search {
        max-width: 100%;
    }

    .mmc-pdf-categories {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }

    .mmc-category-btn {
        padding: 8px 14px;
        font-size: 13px;
        white-space: nowrap;
    }

    .mmc-pdf-grid,
    .mmc-pdf-grid[data-columns="2"],
    .mmc-pdf-grid[data-columns="3"],
    .mmc-pdf-grid[data-columns="4"] {
        grid-template-columns: 1fr;
    }

    .mmc-pdf-card {
        padding: 20px;
    }

    .mmc-pdf-icon {
        font-size: 40px;
    }

    .mmc-pdf-icon svg,
    .mmc-pdf-icon i,
    .mmc-pdf-icon .dashicons {
        font-size: 40px;
        width: 40px;
        height: 40px;
    }

    .mmc-pdf-title {
        font-size: 16px;
    }

    .mmc-pdf-actions {
        flex-direction: column;
    }

    .mmc-btn {
        width: 100%;
    }

    /* List layout on mobile */
    .mmc-pdf-grid[data-layout="list"] .mmc-pdf-card-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .mmc-pdf-grid[data-layout="list"] .mmc-pdf-actions {
        flex-direction: column;
        width: 100%;
    }

    /* Table layout on mobile */
    .mmc-pdf-grid[data-layout="table"] .mmc-pdf-card-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .mmc-pdf-grid[data-layout="table"] .mmc-pdf-actions {
        flex-direction: column;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .mmc-pdf-library {
        padding: 10px 0;
    }

    .mmc-category-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .mmc-category-count {
        min-width: 18px;
        height: 18px;
        font-size: 10px;
    }
}

/* ========== PRINT STYLES ========== */
@media print {
    .mmc-pdf-library-controls,
    .mmc-pdf-actions,
    .mmc-pdf-stats {
        display: none;
    }

    .mmc-pdf-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* ========== DARK MODE SUPPORT ========== */
@media (prefers-color-scheme: dark) {
    .mmc-pdf-library {
        --mmc-pdf-card-bg: #1f2937;
        --mmc-pdf-border: #374151;
        --mmc-pdf-title: #f9fafb;
        --mmc-pdf-text: #9ca3af;
    }

    .mmc-pdf-search-input {
        background: #374151;
        color: #f9fafb;
    }

    .mmc-pdf-empty {
        background: #111827;
    }
}
