/* File Download Manager - Frontend Styles (Shortcode Version) */

/* Theme Variables */
:root {
    --fdm-bg-color: #ffffff;
    --fdm-text-color: #333333;
    --fdm-accent-color: #f8f9fa;
    --fdm-button-color: #667eea;
}

/* Light Theme */
:root[data-fdm-theme="light"] {
    --fdm-bg-color: #ffffff;
    --fdm-text-color: #333333;
    --fdm-accent-color: #f8f9fa;
    --fdm-button-color: #667eea;
}

/* Dark Theme */
:root[data-fdm-theme="dark"] {
    --fdm-bg-color: #2c3e50;
    --fdm-text-color: #ffffff;
    --fdm-accent-color: #667eea;
    --fdm-button-color: #667eea;
}

/* Custom Theme (uses custom CSS properties set via JavaScript) */
:root[data-fdm-theme="custom"] {
    --fdm-bg-color: var(--fdm-custom-bg, #ffffff);
    --fdm-text-color: var(--fdm-custom-text, #333333);
    --fdm-accent-color: var(--fdm-custom-accent, #667eea);
    --fdm-button-color: var(--fdm-custom-button, #667eea);
}

.fdm-download-block {
    margin: 20px 0;
    background: var(--fdm-bg-color);
    color: var(--fdm-text-color);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.fdm-title {
    margin: 0 0 20px 0;
    padding: 20px 20px 0 20px;
    font-size: 24px;
    color: var(--fdm-text-color);
    font-weight: 600;
}

.fdm-group {
    margin-bottom: 30px;
}

.fdm-group:last-child {
    margin-bottom: 0;
}

.fdm-group-title {
    margin: 0 0 20px 0;
    padding: 15px 20px;
    background: var(--fdm-accent-color);
    border-bottom: 1px solid #e0e0e0;
    font-size: 18px;
    font-weight: 600;
    color: var(--fdm-text-color);
}

.fdm-table-container {
    overflow-x: auto;
    border-radius: 8px;
}

.fdm-table-container.fdm-table-scroll {
    box-shadow: inset -10px 0 10px -10px rgba(0,0,0,0.1);
}

.fdm-download-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: var(--fdm-bg-color);
}

.fdm-download-table thead th {
    background: #2c3e50;
    color: #fff;
    font-weight: 600;
    padding: 15px 20px;
    text-align: left;
    border: none;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fdm-download-table thead th:first-child {
    padding-left: 30px;
}

/* Light theme header styling */
.fdm-download-table thead th {
    background-color: #e9ecef;
    color: #495057;
}

.fdm-download-table tbody tr {
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #e9ecef;
}

.fdm-download-table tbody tr:hover {
    background-color: #f8f9fa;
}

.fdm-download-table tbody tr:hover .fdm-file-name strong {
    color: #333;
}

.fdm-download-table tbody tr:hover .fdm-file-info,
.fdm-download-table tbody tr:hover .fdm-count-number,
.fdm-download-table tbody tr:hover .fdm-file-size {
    color: #666;
}

.fdm-download-table tbody tr:last-child {
    border-bottom: none;
}

.fdm-download-table td {
    padding: 20px;
    vertical-align: top;
    border: none;
}

.fdm-file-name {
    min-width: 200px;
    padding-left: 30px;
}

.comment-content td:first-child, 
.comment-content th:first-child, 
.entry-content td:first-child, 
.entry-content th:first-child {
    padding-left: 30px;
}

.fdm-file-name strong {
    display: block;
    font-size: 16px;
    color: var(--fdm-text-color);
    margin-bottom: 8px;
    line-height: 1.4;
}

.fdm-file-meta {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}


.fdm-file-info {
    margin-top: 4px;
    font-size: 12px;
    color: #ccc;
    line-height: 1.3;
}

.fdm-tags {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    color: #7b1fa2;
    background: #f3e5f5;
    padding: 4px 8px;
    border-radius: 12px;
    margin-top: 5px;
}

.fdm-count-number {
    color: #ccc;
    font-size: 12px;
}

.fdm-count-updated {
    animation: pulse 0.6s ease-in-out;
    background: #4caf50 !important;
    color: #fff !important;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.fdm-download-action {
    text-align: center;
    min-width: 140px;
}

.fdm-download-btn {
    background: var(--fdm-button-color);
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    text-decoration: none;
    min-width: 120px;
}

.fdm-download-btn:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    color: #fff;
}

.fdm-download-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.fdm-progress-container {
    margin-top: 12px;
    display: none;
}

.fdm-progress-bar {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.fdm-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.fdm-progress-text {
    font-size: 12px;
    color: #666;
    text-align: center;
    display: block;
}

/* Single File Download Styles */
.fdm-single-download {
    margin: 20px 0;
    background: var(--fdm-bg-color);
    color: var(--fdm-text-color);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.fdm-single-file-info {
    max-width: 400px;
    margin: 0 auto;
}

.fdm-single-download .fdm-file-name {
    margin-bottom: 10px;
    font-size: 18px;
    color: var(--fdm-text-color);
}

.fdm-single-download .fdm-file-meta {
    margin-bottom: 20px;
    color: #666;
    font-size: 14px;
    justify-content: center;
}

.fdm-single-download .fdm-download-btn {
    margin-bottom: 15px;
}

.fdm-single-download .fdm-progress-container {
    max-width: 300px;
    margin: 0 auto;
}

/* Error Messages */
.fdm-no-files,
.fdm-error {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 15px;
    border-radius: 4px;
    margin: 20px 0;
}

.fdm-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Responsive Design */
@media (max-width: 768px) {
    .fdm-download-table {
        font-size: 14px;
    }
    
    .fdm-download-table th,
    .fdm-download-table td {
        padding: 12px 8px;
    }
    
    .fdm-file-name strong {
        font-size: 14px;
    }
    
    .fdm-file-meta {
        flex-direction: column;
        gap: 6px;
    }
    
    .fdm-download-btn {
        padding: 8px 12px;
        font-size: 12px;
        min-width: 100px;
    }
    
    .fdm-group-title {
        padding: 12px 15px;
        font-size: 16px;
    }
    
    .fdm-title {
        padding: 15px 15px 0 15px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .fdm-download-table,
    .fdm-download-table thead,
    .fdm-download-table tbody,
    .fdm-download-table th,
    .fdm-download-table td,
    .fdm-download-table tr {
        display: block;
    }
    
    .fdm-download-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .fdm-download-table tr {
        border: 1px solid #e0e0e0;
        margin-bottom: 15px;
        border-radius: 8px;
        background: #fff;
        padding: 15px;
    }
    
    .fdm-download-table td {
        border: none;
        position: relative;
        padding: 8px 0 8px 40%;
        text-align: right;
    }
    
    .fdm-download-table td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 0;
        width: 35%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 600;
        color: #333;
        text-align: left;
    }
    
    .fdm-file-name {
        text-align: left;
        padding-left: 0;
    }
    
    .fdm-file-name:before {
        display: none;
    }
    
    .fdm-download-action {
        text-align: center;
        padding-left: 0;
    }
    
    .fdm-download-action:before {
        display: none;
    }
    
    .fdm-single-download {
        padding: 15px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .fdm-download-block,
    .fdm-single-download {
        background: #1e1e1e;
        border-color: #333;
    }
    
    .fdm-group-title {
        background: #2d2d2d;
        color: #fff;
        border-color: #444;
    }
    
    .fdm-download-table {
        background: #1e1e1e;
    }
    
    .fdm-download-table thead th {
        background-color: #343a40;
        color: #f8f9fa;
    }
    
    .fdm-download-table tbody tr:hover {
        background-color: #2d2d2d;
    }
    
    .fdm-download-table tbody tr:hover .fdm-file-name strong,
    .fdm-download-table tbody tr:hover .fdm-title {
        color: #fff;
    }
    
    .fdm-download-table tbody tr:hover .fdm-file-info,
    .fdm-download-table tbody tr:hover .fdm-count-number,
    .fdm-download-table tbody tr:hover .fdm-file-size {
        color: #ccc;
    }
    
    .fdm-download-table tbody tr {
        border-color: #333;
    }
    
    .fdm-file-name strong,
    .fdm-title {
        color: #fff;
    }
    
    .fdm-file-size {
        color: #ccc;
    }
    
    .fdm-file-info {
        color: #ccc;
    }
    
    .fdm-count-number {
        color: #ccc;
    }
    
    .fdm-progress-bar {
        background: #333;
    }
    
    .fdm-tags {
        background: #4a148c;
        color: #e1bee7;
    }
    
    .fdm-progress-text {
        color: #ccc;
    }
}

/* Print styles */
@media print {
    .fdm-download-btn,
    .fdm-progress-container {
        display: none;
    }
    
    .fdm-download-table {
        border: 1px solid #000;
    }
    
    .fdm-download-table th,
    .fdm-download-table td {
        border: 1px solid #000;
        padding: 8px;
    }
    
    .fdm-group-title,
    .fdm-title {
        background: none;
        color: #000;
        border-bottom: 2px solid #000;
    }
}