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

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-color: #667eea;
    --primary-dark: #764ba2;
    --secondary-color: #f8f9fa;
    --text-dark: #2c3e50;
    --text-light: #6c757d;
    --border-color: #e0e6ed;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.25);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--primary-gradient);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 1400px;
}

/* Login Box */
.login-box {
    background: white;
    border-radius: var(--radius-lg);
    padding: 50px;
    box-shadow: var(--shadow-lg);
    max-width: 480px;
    margin: 0 auto;
    animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header {
    text-align: center;
    margin-bottom: 40px;
}

.logo {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.logo svg {
    filter: drop-shadow(0 4px 12px rgba(102, 126, 234, 0.3));
}

.header h1 {
    color: var(--text-dark);
    font-size: 2em;
    font-weight: 700;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-light);
    font-size: 1em;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 0.95em;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 15px;
    transition: all 0.3s ease;
    background: white;
}

.form-group input::placeholder {
    color: #a0aec0;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary {
    background: var(--secondary-color);
    color: var(--text-dark);
}

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

.error-message {
    color: var(--error-color);
    margin-top: 16px;
    text-align: center;
    font-weight: 500;
    font-size: 0.9em;
}

/* Dashboard */
.dashboard {
    background: white;
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.6s ease;
}

.dashboard .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    text-align: left;
    padding-bottom: 30px;
    border-bottom: 2px solid var(--secondary-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-small svg {
    filter: drop-shadow(0 2px 8px rgba(102, 126, 234, 0.2));
}

.dashboard .header h1 {
    margin: 0;
    font-size: 1.8em;
}

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

.user-badge {
    background: var(--secondary-color);
    color: var(--text-dark);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9em;
}

/* Upload Section */
.upload-section {
    background: var(--secondary-color);
    padding: 32px;
    border-radius: var(--radius-md);
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.section-header h2 {
    color: var(--text-dark);
    font-size: 1.4em;
    margin-bottom: 4px;
}

.section-description {
    color: var(--text-light);
    font-size: 0.9em;
}

#uploadForm {
    display: flex;
    gap: 16px;
    align-items: flex-end;
}

.file-input-wrapper {
    flex: 1;
}

.file-input-wrapper input[type="file"] {
    display: none;
}

.file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    background: white;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 8px;
}

.file-label svg {
    color: var(--primary-color);
    margin-bottom: 8px;
}

.file-label:hover {
    border-color: var(--primary-color);
    background: #f8f9ff;
}

.file-label-text {
    color: var(--text-dark);
    font-weight: 600;
    font-size: 1em;
}

.file-label-hint {
    color: var(--text-light);
    font-size: 0.85em;
}

.btn-upload {
    min-width: 140px;
}

.status-message {
    margin-top: 16px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9em;
}

.status-message.success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success-color);
}

.status-message.error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--error-color);
}

.status-message.info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

/* Files Section */
.files-section {
    margin-top: 32px;
}

.files-section .section-header {
    margin-bottom: 24px;
}

.btn-refresh {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.file-card {
    background: var(--secondary-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.file-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
    background: white;
}

.file-icon {
    font-size: 2.5em;
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: var(--radius-sm);
}

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

.file-name {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.95em;
}

.file-meta {
    font-size: 0.8em;
    color: var(--text-light);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.file-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-icon {
    background: white;
    border: 2px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    transform: scale(1.08);
    border-color: var(--primary-color);
    background: #f8f9ff;
}

.btn-icon.delete:hover {
    border-color: var(--error-color);
    background: #fef2f2;
}

.loading, .no-files, .error {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
    font-size: 1em;
}

.error {
    color: var(--error-color);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .files-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    body {
        padding: 16px;
    }

    .login-box {
        padding: 32px 24px;
    }

    .dashboard {
        padding: 24px;
    }

    .header h1 {
        font-size: 1.6em;
    }

    .dashboard .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .header-left {
        flex-direction: row;
    }

    .user-info {
        width: 100%;
        justify-content: space-between;
    }

    .upload-section {
        padding: 24px;
    }

    #uploadForm {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-upload {
        width: 100%;
    }

    .files-grid {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        gap: 16px;
    }

    .btn-refresh {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .login-box {
        padding: 28px 20px;
    }

    .dashboard {
        padding: 20px;
    }

    .header h1 {
        font-size: 1.4em;
    }

    .logo-small svg {
        width: 32px;
        height: 32px;
    }

    .file-card {
        flex-direction: column;
        text-align: center;
        padding: 16px;
    }

    .file-info {
        width: 100%;
    }

    .file-actions {
        width: 100%;
        justify-content: center;
    }

    .file-label {
        padding: 24px 16px;
    }

    .user-badge {
        font-size: 0.85em;
        padding: 6px 12px;
    }
}

/* Admin Panel */
.admin-panel {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 32px;
    margin-bottom: 32px;
}

.admin-header {
    margin-bottom: 32px;
}

.admin-header h2 {
    color: var(--text-dark);
    font-size: 1.4em;
    margin-bottom: 4px;
}

.admin-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.admin-section {
    background: white;
    padding: 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.admin-section h3 {
    color: var(--text-dark);
    font-size: 1.1em;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.admin-section form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 15px;
    transition: all 0.3s ease;
    background: white;
    cursor: pointer;
}

.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* Users Table */
.users-table-wrapper {
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.users-table thead {
    background: var(--secondary-color);
    border-bottom: 2px solid var(--border-color);
}

.users-table th {
    padding: 12px 16px;
    text-align: left;
    color: var(--text-dark);
    font-weight: 600;
}

.users-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-dark);
}

.users-table tbody tr:hover {
    background: var(--secondary-color);
}

.role-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85em;
}

.role-badge.role-admin {
    background: #fef3c7;
    color: #92400e;
}

.role-badge.role-user {
    background: #dbeafe;
    color: #1e40af;
}

.badge-current {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
    margin-left: 6px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85em;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-small:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-small.btn-edit:hover {
    background: #f8f9ff;
}

.btn-small.btn-delete:hover {
    border-color: var(--error-color);
    color: var(--error-color);
    background: #fef2f2;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 0;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    animation: slideDown 0.3s ease;
}

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

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

.modal-header h3 {
    color: var(--text-dark);
    font-size: 1.2em;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-light);
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--text-dark);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* User Section */
.user-section {
    margin-top: 32px;
}

/* Responsive Admin */
@media (max-width: 1024px) {
    .admin-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .admin-panel {
        padding: 24px;
    }

    .admin-section {
        padding: 16px;
    }

    .users-table {
        font-size: 0.8em;
    }

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

    .modal-content {
        width: 95%;
        margin: 30% auto;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles if needed */
}

