:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f7;
    --bg-tertiary: #e8e8ed;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --text-tertiary: #a1a1a6;
    --accent-blue: #007aff;
    --accent-green: #34c759;
    --accent-red: #ff3b30;
    --accent-yellow: #ffcc00;
    --border-color: #d2d2d7;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --hover-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-primary: #1d1d1f;
    --bg-secondary: #2c2c2e;
    --bg-tertiary: #3a3a3c;
    --text-primary: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-tertiary: #6e6e73;
    --border-color: #424245;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --hover-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    transition: var(--transition);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo i {
    font-size: 2.5rem;
    color: var(--accent-red);
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

.theme-toggle button {
    background: var(--bg-secondary);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle button:hover {
    background: var(--bg-tertiary);
}

.theme-toggle i {
    font-size: 1.2rem;
    color: var(--text-primary);
}

/* Card Design */
.card {
    background: var(--bg-secondary);
    border-radius: 18px;
    padding: 30px;
    margin: 25px 0;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--hover-shadow);
}

.card h2, .card h3, .card h4 {
    margin-bottom: 15px;
    color: var(--text-primary);
    font-weight: 600;
}

.card h2 i, .card h3 i, .card h4 i {
    margin-right: 10px;
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 25px;
    font-size: 0.95rem;
}

/* Stats */
.stats, .file-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 25px 0;
    flex-wrap: wrap;
}

.stat, .file-stat {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    font-size: 0.9rem;
}

.stat i, .file-stat i {
    color: var(--accent-blue);
}

/* Drag & Drop Zone */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 18px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    margin: 25px 0;
    transition: var(--transition);
    position: relative;
    background: var(--bg-primary);
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--accent-blue);
    background: var(--bg-secondary);
}

.drop-zone i {
    color: var(--accent-blue);
    margin-bottom: 15px;
}

.drop-text {
    color: var(--text-secondary);
    margin: 10px 0;
    font-size: 1.1rem;
}

.file-types {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    margin-top: 15px;
}

#fileInput {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

/* Selected Files */
.selected-files {
    margin: 30px 0;
}

.files-container {
    min-height: 150px;
    max-height: 300px;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin: 15px 0;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    margin-bottom: 10px;
    transition: var(--transition);
}

.file-item:hover {
    background: var(--border-color);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-icon {
    width: 36px;
    height: 36px;
    background: var(--accent-blue);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.file-name {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.remove-file {
    background: none;
    border: none;
    color: var(--accent-red);
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: var(--transition);
}

.remove-file:hover {
    background: var(--accent-red);
    color: white;
}

/* Buttons */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary {
    background: var(--accent-blue);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-success {
    background: var(--accent-green);
    color: white;
}

.btn-info {
    background: var(--accent-blue);
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.action-buttons, .download-options {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

/* Progress Bar */
.progress-section {
    animation: slideDown 0.5s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.progress-info {
    margin-top: 20px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

#timeRemaining {
    color: var(--accent-blue);
    font-weight: 500;
}

.progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin: 15px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Results */
.results-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.result-item {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: var(--transition);
}

.result-item:hover {
    border-color: var(--accent-blue);
    transform: translateY(-2px);
}

.result-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-red);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.result-info {
    flex: 1;
}

.result-name {
    font-weight: 500;
    margin-bottom: 5px;
}

.result-size {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.download-single {
    padding: 8px 15px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}

.download-single:hover {
    opacity: 0.9;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--hover-shadow);
    animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

.footer-info {
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

/* Loading Spinner */
.loading-spinner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.loading-spinner.active {
    display: flex;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--bg-tertiary);
    border-top: 4px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    color: white;
    font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .card {
        padding: 20px;
    }
    
    .stats, .file-stats {
        gap: 15px;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    
    .results-container {
        grid-template-columns: 1fr;
    }
}