/* ========================
   CSS Variables & Reset
======================== */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --accent: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.8);
    --bg-card-hover: rgba(51, 65, 85, 0.9);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: rgba(148, 163, 184, 0.2);
    --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --radius: 16px;
    --radius-sm: 8px;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1e293b 50%, #0f172a 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

/* ========================
   Layout
======================== */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================
   Header
======================== */
.header {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--radius);
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    position: relative;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
    position: relative;
}

/* ========================
   Navigation Tabs
======================== */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: var(--bg-card);
    padding: 8px;
    border-radius: var(--radius);
    backdrop-filter: blur(10px);
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
    display: block;
}

.tab-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    color: var(--text-primary);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* ========================
   Cards
======================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 30px;
    margin-bottom: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

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

.card-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ========================
   Forms
======================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.form-group input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.form-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* ========================
   Buttons
======================== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(148, 163, 184, 0.3);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
}

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

.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-large {
    padding: 18px 40px;
    font-size: 1.2rem;
}

.btn-upload {
    background: rgba(6, 182, 212, 0.2);
    color: var(--accent);
    border: 2px dashed var(--accent);
    width: 100%;
    margin-top: 15px;
}

.btn-upload:hover {
    background: rgba(6, 182, 212, 0.3);
}

/* ========================
   Tables
======================== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

thead {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.9) 0%, rgba(139, 92, 246, 0.9) 100%);
    backdrop-filter: blur(5px);
}

th {
    padding: 18px 20px;
    text-align: left;
    font-weight: 700;
    color: white;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
    transition: all 0.2s ease;
}

tbody tr {
    transition: all 0.2s ease;
    background: transparent;
}

tbody tr:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.002);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Zebra striping for better readability */
tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

tbody tr:nth-child(even):hover {
    background: rgba(99, 102, 241, 0.1);
}

.empty-message {
    text-align: center;
    padding: 60px;
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-style: italic;
    background: rgba(0, 0, 0, 0.2);
}

/* ========================
   Pagination
======================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 25px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 15px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.page-link:hover {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.page-item.disabled .page-link {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ========================
   Search Input
======================== */
.search-input {
    padding: 12px 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-primary);
    font-size: 0.95rem;
    min-width: 250px;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ========================
   Upload Cards
======================== */
.upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.upload-card {
    background: rgba(15, 23, 42, 0.6);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
}

.upload-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
}

.upload-card.uploaded {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.upload-card h3 {
    font-size: 1.2rem;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.kelas-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.file-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 12px;
    word-break: break-all;
}

.upload-status {
    margin-top: 10px;
    font-size: 0.85rem;
}

.upload-status.success {
    color: var(--success);
}

.upload-status.error {
    color: var(--danger);
}

.btn-view {
    margin-top: 5px;
    width: 100%;
}

.large-modal {
    max-width: 800px;
    width: 95%;
}

.btn-warning {
    background: var(--warning);
    color: #1a1a2e;
}

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

/* ========================
   Lock Semester
======================== */
.upload-card.locked {
    border-color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
    position: relative;
}

.upload-card.locked::after {
    content: '🔒';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.2rem;
}

.upload-card.locked .btn-upload {
    opacity: 0.5;
    pointer-events: none;
}

.btn-lock {
    margin-top: 10px;
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.btn-lock:hover {
    background: rgba(245, 158, 11, 0.3);
}

/* ========================
   Process Section
======================== */
.process-section {
    text-align: center;
    padding: 20px;
    border-top: 1px solid var(--border-color);
    margin-top: 20px;
}

.proses-status {
    margin-top: 15px;
    padding: 15px;
    border-radius: var(--radius-sm);
    display: none;
}

.proses-status.show {
    display: block;
}

.proses-status.success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.proses-status.error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

/* ========================
   Stats Summary
======================== */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

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

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 30px;
    width: 90%;
    max-width: 500px;
    border: 1px solid var(--border-color);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.modal-header h3 {
    font-size: 1.3rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.8rem;
    cursor: pointer;
    transition: color 0.2s;
}

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

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

/* ========================
   Tab Content
======================== */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================
   Footer
======================== */
.footer {
    text-align: center;
    padding: 25px;
    color: var(--text-secondary);
    margin-top: auto;
}

/* ========================
   Info Text
======================== */
.info-text {
    color: var(--text-secondary);
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(6, 182, 212, 0.1);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-sm);
}

/* ========================
   Template Download
======================== */
.template-download {
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-sm);
    text-align: center;
}

.template-label {
    margin-bottom: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.template-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.btn-template {
    padding: 10px 18px;
    font-size: 0.9rem;
}

/* ========================
   Grade Colors
======================== */
.grade-excellent {
    color: var(--success);
    font-weight: 700;
}

.grade-good {
    color: var(--accent);
    font-weight: 600;
}

.grade-average {
    color: var(--warning);
}

.grade-poor {
    color: var(--danger);
}

/* ========================
   Responsive Design
======================== */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }

    .tabs {
        flex-direction: column;
    }

    .tab-btn {
        text-align: center;
    }

    .card {
        padding: 20px;
    }

    .card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input {
        min-width: 100%;
    }

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

    .btn-large {
        padding: 15px 30px;
        font-size: 1rem;
    }

    th,
    td {
        padding: 10px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 10px;
    }

    .header {
        padding: 25px 15px;
    }

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

/* ========================
   Scrollbar Styling
======================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}