* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    color: #667eea;
    margin-bottom: 10px;
    text-align: center;
}

.login-box h2 {
    color: #555;
    margin-bottom: 30px;
    text-align: center;
    font-weight: normal;
}

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

header {
    background: white;
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

header h1 {
    color: #667eea;
    font-size: 24px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info span {
    color: #555;
}

/* Main Content */
main {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 20px;
}

/* Upload Area */
.upload-section {
    cursor: pointer;
}

.upload-area {
    border: 3px dashed #667eea;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    transition: all 0.3s;
    background: #f8f9ff;
}

.upload-area:hover {
    background: #f0f2ff;
    border-color: #764ba2;
}

.upload-area.dragover {
    background: #e8ebff;
    border-color: #764ba2;
}

.upload-prompt p {
    color: #667eea;
    font-size: 18px;
    margin-bottom: 10px;
}

.file-types {
    color: #999;
    font-size: 14px;
}

.upload-status {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    display: none;
}

.upload-status.success {
    display: block;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.upload-status.error {
    display: block;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.upload-status.loading {
    display: block;
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Files Table */
.files-table {
    width: 100%;
    border-collapse: collapse;
}

.files-table thead {
    background: #f8f9fa;
}

.files-table th {
    text-align: left;
    padding: 15px;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #dee2e6;
}

.files-table td {
    padding: 15px;
    border-bottom: 1px solid #dee2e6;
}

.files-table tbody tr:hover {
    background: #f8f9ff;
}

.no-files {
    text-align: center;
    color: #999;
    padding: 40px;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-complete {
    background: #d4edda;
    color: #155724;
}

.status-processing {
    background: #cce5ff;
    color: #004085;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    margin-right: 5px;
}

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

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e4e8;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
}

/* Admin Specific */
.filter-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: #f8f9ff;
}

.tab-btn.active {
    background: #667eea;
    color: white;
}

.stats-section {
    margin-top: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    color: white;
}

.stat-card h3 {
    font-size: 36px;
    margin-bottom: 10px;
}

.stat-card p {
    font-size: 14px;
    opacity: 0.9;
}

/* Dark Mode Toggle */
.dark-mode-toggle {
    background: none;
    border: 2px solid #667eea;
    color: #667eea;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.dark-mode-toggle:hover {
    background: #667eea;
    color: white;
}

/* Dark Mode Styles */
body.dark-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e0e0e0;
}

body.dark-mode .login-box,
body.dark-mode header,
body.dark-mode section {
    background: #2a2a3e;
    color: #e0e0e0;
}

body.dark-mode .login-box h2,
body.dark-mode section h2 {
    color: #e0e0e0;
}

body.dark-mode .user-info span {
    color: #b0b0b0;
}

body.dark-mode .upload-area {
    background: #1e1e2e;
    border-color: #667eea;
}

body.dark-mode .upload-area:hover {
    background: #252538;
}

body.dark-mode .upload-prompt p {
    color: #8b9aee;
}

body.dark-mode .file-types {
    color: #888;
}

body.dark-mode .files-table thead {
    background: #1e1e2e;
}

body.dark-mode .files-table th {
    color: #b0b0b0;
    border-bottom-color: #3a3a4e;
}

body.dark-mode .files-table td {
    border-bottom-color: #3a3a4e;
}

body.dark-mode .files-table tbody tr:hover {
    background: #353548;
}

body.dark-mode .no-files {
    color: #888;
}

body.dark-mode .form-group label {
    color: #b0b0b0;
}

body.dark-mode .form-group input {
    background: #1e1e2e;
    border-color: #3a3a4e;
    color: #e0e0e0;
}

body.dark-mode .form-group input:focus {
    border-color: #667eea;
}

body.dark-mode .tab-btn {
    background: #1e1e2e;
    border-color: #667eea;
    color: #8b9aee;
}

body.dark-mode .tab-btn:hover {
    background: #252538;
}

body.dark-mode .tab-btn.active {
    background: #667eea;
    color: white;
}

body.dark-mode .dark-mode-toggle {
    border-color: #8b9aee;
    color: #8b9aee;
}

body.dark-mode .dark-mode-toggle:hover {
    background: #8b9aee;
    color: #1a1a2e;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .files-table {
        font-size: 12px;
    }

    .files-table th,
    .files-table td {
        padding: 10px;
    }
}

/* Countdown badges */
.countdown-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 12px;
}
.countdown-green { background: #4caf50; color: white; }
.countdown-yellow { background: #ff9800; color: white; }
.countdown-red { background: #f44336; color: white; }
.countdown-expired { background: #f44336; color: white; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.5; } }
.btn-danger { background: #f44336; color: white; }
.btn-danger:hover { background: #d32f2f; }
.days-input { padding: 2px; border: 1px solid #ccc; border-radius: 3px; }

/* User Management Styles */
.user-form .form-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.user-form .form-group {
    flex: 1;
    min-width: 150px;
}

.user-form .form-actions {
    flex: 0 0 auto;
}

.form-select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e4e8;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: #667eea;
}

.role-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.role-admin {
    background: #667eea;
    color: white;
}

.role-user {
    background: #6c757d;
    color: white;
}

.protected-badge {
    display: inline-block;
    padding: 4px 8px;
    background: #fff3cd;
    color: #856404;
    border-radius: 4px;
    font-size: 11px;
    margin-right: 8px;
}

.status-message {
    padding: 12px;
    border-radius: 6px;
    margin-top: 15px;
    display: none;
}

.status-success {
    display: block;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

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

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

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

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

/* Dark mode for user management */
body.dark-mode .form-select {
    background: #1e1e2e;
    border-color: #3a3a4e;
    color: #e0e0e0;
}

body.dark-mode .modal-content {
    background: #2a2a3e;
}

body.dark-mode .modal-header h2 {
    color: #e0e0e0;
}

body.dark-mode .modal-close {
    color: #888;
}

body.dark-mode .modal-close:hover {
    color: #e0e0e0;
}

body.dark-mode .protected-badge {
    background: #3d3d00;
    color: #ffc107;
}

/* Task Selector */
.task-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.task-selector label {
    font-weight: 600;
    color: #555;
}

.task-selector .form-select {
    flex: 1;
    max-width: 300px;
}

body.dark-mode .task-selector {
    background: #1e1e2e;
}

body.dark-mode .task-selector label {
    color: #b0b0b0;
}

/* App Version Display */
.app-version {
    position: fixed;
    bottom: 10px;
    left: 10px;
    font-size: 12px;
    color: #888;
    opacity: 0.7;
    z-index: 1000;
}

.dark-mode .app-version {
    color: #666;
}

/* Upload Progress Bar */
.upload-progress {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 20px;
    margin-top: 15px;
}

.dark-mode .upload-progress {
    background: #2a2a2a;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
}

#uploadFileName {
    font-weight: 500;
    max-width: 70%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#uploadPercent {
    font-weight: bold;
    color: #4CAF50;
}

.progress-bar-container {
    background: #ddd;
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
}

.dark-mode .progress-bar-container {
    background: #444;
}

.progress-bar {
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    height: 100%;
    width: 0%;
    border-radius: 10px;
    transition: width 0.3s ease;
}

.progress-details {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
    text-align: center;
}

.dark-mode .progress-details {
    color: #999;
}
