/* ============================================
   Vazirmatn Font Face - Local Only
   ============================================ */
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ============================================
   CSS Variables
   ============================================ */
:root {
    --pdm-box-bg: #E1F6F7;
    --pdm-content-bg: #FCFCFC;
    --pdm-primary: #004D40;
    --pdm-primary-hover: #003d33;
    --pdm-accent: #FFB300;
    --pdm-text: #2d2d2d;
    --pdm-text-light: #666666;
    --pdm-border: #d0e0e1;
    --pdm-radius: 6px;
    --pdm-transition: 0.2s ease;
}

/* ============================================
   Main Container
   ============================================ */
.pdm-downloads-box {
    font-family: 'Vazirmatn', sans-serif;
    direction: rtl;
    text-align: right;
    max-width: 700px;
    margin: 1.5rem 0;
    background-color: var(--pdm-box-bg);
    border-radius: var(--pdm-radius);
    padding: 1.25rem 1.5rem;
    box-sizing: border-box;
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--pdm-text);
}

/* ============================================
   Header
   ============================================ */
.pdm-downloads-header {
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(0, 77, 64, 0.12);
}

.pdm-downloads-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--pdm-primary);
    margin: 0 0 0.2rem 0;
}

.pdm-downloads-subtitle {
    font-size: 0.85rem;
    color: var(--pdm-text-light);
    margin: 0;
}

/* ============================================
   File List
   ============================================ */
.pdm-file-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ============================================
   Each File Card - 3 Rows
   ============================================ */
.pdm-file-item {
    background-color: var(--pdm-content-bg);
    border: 1px solid var(--pdm-border);
    border-radius: var(--pdm-radius);
    padding: 1rem 1.25rem;
}

/* ============================================
   Row 1: Title (80%) + Format (20%)
   ============================================ */
.pdm-row-1 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.pdm-col-title {
    width: 80%;
}

.pdm-file-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--pdm-text);
    word-break: break-word;
    line-height: 1.6;
}

.pdm-col-format {
    width: 20%;
    text-align: left;
}

.pdm-file-type-badge {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    background-color: rgba(255, 179, 0, 0.15);
    color: #8a6500;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    text-align: center;
}

/* ============================================
   Row 2: File Size (50%) + Download Count (50%)
   ============================================ */
.pdm-row-2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.pdm-col-size {
    width: 50%;
    font-size: 0.9rem;
    color: var(--pdm-text-light);
}

.pdm-col-count {
    width: 50%;
    text-align: left;
    font-size: 0.9rem;
    color: var(--pdm-text-light);
}

.pdm-file-size-label,
.pdm-download-count-label {
    color: #999;
    font-size: 0.8rem;
    margin-left: 0.25rem;
}

/* ============================================
   Row 3: Download Button + Related Texts (Center)
   ============================================ */
.pdm-row-3 {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    text-align: center;
}

/* Button */
.pdm-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.6rem 2rem;
    background-color: var(--pdm-primary);
    color: #ffffff;
    border: none;
    border-radius: var(--pdm-radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--pdm-transition);
    white-space: nowrap;
    font-family: 'Vazirmatn', sans-serif;
    min-width: 120px;
}

.pdm-download-btn:hover:not(:disabled) {
    background-color: var(--pdm-primary-hover);
}

.pdm-download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Button States */
.pdm-download-btn.loading {
    background-color: #78909c;
}

.pdm-download-btn.counting {
    background-color: var(--pdm-accent);
    color: #3e2800;
}

.pdm-download-btn.ready {
    background-color: #27ae60;
}

/* Countdown Timer */
.pdm-countdown-timer {
    display: none;
    font-size: 0.9rem;
    color: #8a6500;
    font-weight: 500;
}

.pdm-countdown-timer.active {
    display: inline-block;
}

/* Download Link (replaces button) */
.pdm-download-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.6rem 2rem;
    background-color: var(--pdm-primary);
    color: #ffffff;
    text-decoration: none;
    border-radius: var(--pdm-radius);
    font-size: 0.95rem;
    font-weight: 600;
    transition: background-color var(--pdm-transition);
    font-family: 'Vazirmatn', sans-serif;
}

.pdm-download-link:hover {
    background-color: var(--pdm-primary-hover);
    color: #ffffff;
    text-decoration: none;
}

.pdm-link-badge {
    font-size: 0.75rem;
    opacity: 0.85;
    margin-right: 0.4rem;
    padding-right: 0.4rem;
    border-right: 1px solid rgba(255,255,255,0.3);
}

/* Fallback Link */
.pdm-fallback-link {
    display: none;
    font-size: 0.85rem;
}

.pdm-fallback-link.show {
    display: block;
}

.pdm-fallback-link a {
    color: var(--pdm-accent);
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px dashed var(--pdm-accent);
}

.pdm-fallback-link a:hover {
    color: #cc8f00;
    border-bottom-style: solid;
}

/* ============================================
   Error Message
   ============================================ */
.pdm-error-message {
    margin-top: 0.3rem;
    padding: 0.5rem 0.75rem;
    background-color: #fdf2f2;
    border: 1px solid #f5c6cb;
    border-radius: var(--pdm-radius);
    color: #721c24;
    font-size: 0.85rem;
    text-align: center;
}

/* ============================================
   Empty State
   ============================================ */
.pdm-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--pdm-text-light);
    font-size: 0.95rem;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 600px) {
    .pdm-downloads-box {
        padding: 0.75rem;
    }
    
    .pdm-file-item {
        padding: 0.75rem;
    }
    
    .pdm-row-1 {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .pdm-col-title,
    .pdm-col-format {
        width: 100%;
        text-align: right;
    }
    
    .pdm-col-format {
        text-align: right;
    }
    
    .pdm-col-count {
        text-align: right;
    }
    
    .pdm-download-btn {
        width: 100%;
    }
}