/* Downloads Page Styles */

.downloads-header {
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.downloads-header h1 {
    margin: 0;
    font-size: 2rem;
    color: var(--text-color, #333);
}

.downloads-header .page-description {
    color: var(--text-muted, #666);
    margin: 0;
}

.downloads-header .header-actions {
    margin-top: 1rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg, #fff);
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.stat-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light, #e3f2fd);
    border-radius: 10px;
}

.stat-info h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-color, #333);
}

.stat-info p {
    margin: 0.25rem 0 0 0;
    color: var(--text-muted, #666);
    font-size: 0.85rem;
}

/* Downloads Controls */
.downloads-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--input-bg, #fff);
    color: var(--text-color, #333);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color, #2196F3);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.filter-select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--input-bg, #fff);
    color: var(--text-color, #333);
    cursor: pointer;
}

/* Downloads List */
.downloads-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.download-item {
    background: var(--card-bg, #fff);
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    gap: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s;
    border-left: 4px solid transparent;
}

.download-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.download-item.status-completed {
    border-left-color: #4CAF50;
}

.download-item.status-downloading {
    border-left-color: #2196F3;
}

.download-item.status-failed {
    border-left-color: #f44336;
}

.download-item.status-cancelled {
    border-left-color: #9e9e9e;
}

.download-item.status-pending {
    border-left-color: #ff9800;
}

.download-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.download-info {
    flex: 1;
    min-width: 0;
}

.download-filename {
    margin: 0 0 0.25rem 0;
    font-size: 1.1rem;
    color: var(--text-color, #333);
    word-break: break-word;
}

.download-url {
    margin: 0 0 0.5rem 0;
    font-size: 0.85rem;
    color: var(--text-muted, #888);
    word-break: break-all;
    font-family: monospace;
}

.download-description {
    margin: 0.5rem 0;
    color: var(--text-muted, #666);
    font-size: 0.9rem;
}

.download-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted, #666);
}

.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.8rem;
}

.status-badge.status-completed {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-badge.status-downloading {
    background: #e3f2fd;
    color: #1565c0;
}

.status-badge.status-failed {
    background: #ffebee;
    color: #c62828;
}

.status-badge.status-cancelled {
    background: #f5f5f5;
    color: #616161;
}

.status-badge.status-pending {
    background: #fff3e0;
    color: #ef6c00;
}

/* Progress Bar */
.progress-bar {
    height: 8px;
    background: var(--border-color, #e0e0e0);
    border-radius: 4px;
    margin-top: 0.75rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2196F3, #03A9F4);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-muted, #666);
}

.error-text {
    color: #c62828;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* Download Actions */
.download-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    justify-content: center;
}

.download-actions .btn {
    min-width: 40px;
    padding: 0.5rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    background: var(--card-bg, #fff);
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    margin: 0 0 0.5rem 0;
    color: var(--text-color, #333);
}

.empty-state p {
    margin: 0;
    color: var(--text-muted, #666);
}

/* Loading State */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted, #666);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-bg, #fff);
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-content.modal-medium {
    max-width: 600px;
}

.modal-content h2 {
    margin: 0 0 1.5rem 0;
    color: var(--text-color, #333);
}

.modal .close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted, #666);
    line-height: 1;
}

.modal .close:hover {
    color: var(--text-color, #333);
}

/* Form Styles */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color, #333);
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--input-bg, #fff);
    color: var(--text-color, #333);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-muted, #888);
    font-size: 0.8rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    background: #333;
    color: white;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 9999;
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-success {
    background: #4CAF50;
}

.toast-error {
    background: #f44336;
}

.toast-info {
    background: #2196F3;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary-color, #2196F3);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark, #1976D2);
}

.btn-secondary {
    background: var(--secondary-color, #e0e0e0);
    color: var(--text-color, #333);
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-warning {
    background: #ff9800;
    color: white;
}

.btn-warning:hover {
    background: #f57c00;
}

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.btn-accent {
    background: #9c27b0;
    color: white;
}

.btn-accent:hover {
    background: #7b1fa2;
}

/* Share Modal Styles */
.share-file-info {
    margin: 0 0 1.5rem 0;
    padding: 0.75rem;
    background: var(--primary-light, #e3f2fd);
    border-radius: 6px;
    color: var(--text-color, #333);
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.share-result {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #e8f5e9;
    border-radius: 8px;
}

.share-link-container {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.share-link-container input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.85rem;
}

.share-note {
    margin: 0.75rem 0 0 0;
    font-size: 0.85rem;
    color: var(--text-muted, #666);
}

.existing-shares-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color, #e0e0e0);
}

.existing-shares-section h3 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    color: var(--text-color, #333);
}

.existing-shares-section h4 {
    margin: 1rem 0 0.5rem 0;
    font-size: 0.95rem;
    color: var(--text-muted, #666);
}

.share-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--input-bg, #f5f5f5);
    border-radius: 6px;
    gap: 0.5rem;
}

.share-item.share-expired {
    opacity: 0.6;
}

.share-info {
    flex: 1;
    min-width: 0;
}

.share-url {
    display: block;
    font-size: 0.8rem;
    word-break: break-all;
    margin-bottom: 0.25rem;
    background: var(--card-bg, #fff);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.share-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted, #888);
}

.share-actions {
    display: flex;
    gap: 0.25rem;
}

.empty-text,
.loading-text {
    color: var(--text-muted, #888);
    font-size: 0.9rem;
    padding: 0.5rem 0;
}

.mt-1 {
    margin-top: 1rem;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .downloads-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .download-item {
        flex-direction: column;
    }

    .download-icon {
        align-self: flex-start;
    }

    .download-actions {
        flex-direction: row;
        width: 100%;
        justify-content: flex-start;
    }

    .downloads-controls {
        flex-direction: column;
    }

    .search-input,
    .filter-select {
        width: 100%;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .download-item {
        background: var(--card-bg-dark, #2d2d2d);
    }

    .stat-card {
        background: var(--card-bg-dark, #2d2d2d);
    }

    .empty-state {
        background: var(--card-bg-dark, #2d2d2d);
    }

    .status-badge.status-completed {
        background: #1b5e20;
        color: #a5d6a7;
    }

    .status-badge.status-downloading {
        background: #0d47a1;
        color: #90caf9;
    }

    .status-badge.status-failed {
        background: #b71c1c;
        color: #ef9a9a;
    }
}

/* Dark theme class override */
body.dark-theme .download-item,
body.dark-theme .stat-card,
body.dark-theme .empty-state,
body.dark-theme .modal-content {
    background: var(--card-bg, #2d2d2d);
}

body.dark-theme .status-badge.status-completed {
    background: #1b5e20;
    color: #a5d6a7;
}

body.dark-theme .status-badge.status-downloading {
    background: #0d47a1;
    color: #90caf9;
}

body.dark-theme .status-badge.status-failed {
    background: #b71c1c;
    color: #ef9a9a;
}
