/* === Global Style === */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    font-family: 'Arial', sans-serif;
    background-color: #f3f4f6;
    color: #1f2937;
}

/* === Container === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    width: 100%;
}

/* === Layout Flex === */
main, .login-section, .dashboard-section, .feedback-section, .main-section, .change-password-section {
    flex: 1 0 auto;
    padding: 2rem 1rem;
}

/* === Footer === */
.footer {
    flex-shrink: 0;
    background-color: #1f2937;
    color: white;
    text-align: center;
    padding: 1rem 0;
    width: 100%;
    min-width: 100vw; /* Ensure footer spans full viewport width */
}

.footer .container {
    padding: 0 1rem;
}

.footer a {
    color: #60a5fa;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* === Navbar === */
.navbar {
    background-color: #2563eb;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
    min-width: 100vw; /* Ensure navbar spans full viewport width */
    position: sticky; /* Keep navbar at top when scrolling */
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    padding: 0 1rem;
}

.navbar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.navbar-logo img {
    height: 40px;
    width: auto;
}

.navbar-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
}

.nav-link:hover,
.nav-link.active {
    background-color: #1d4ed8;
}

.nav-link.active {
    font-weight: 700;
}

/* Hamburger menu untuk layar sangat kecil */
.navbar-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* === Dropdown User === */
.navbar-user {
    position: relative;
}

.dropbtn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
}

.dropbtn:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background-color: white;
    min-width: 200px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-radius: 0.5rem;
    z-index: 50;
    overflow: hidden;
}

.dropdown-content.show {
    display: block;
}

.dropdown-content .user-name,
.dropdown-content a {
    display: block;
    padding: 0.75rem 1rem;
    color: #1f2937;
    text-decoration: none;
    font-size: 0.95rem;
}

.dropdown-content .user-name {
    font-weight: 600;
    background-color: #f3f4f6;
    cursor: default;
}

.dropdown-content a:hover {
    background-color: #f9fafb;
}

/* === Login Page === */
.login-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 4rem);
}

.login-card {
    background-color: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 28rem;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    color: #2563eb;
    margin-bottom: 1.5rem;
}

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

.form-group label {
    display: block;
    color: #374151;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

.btn-primary {
    width: 100%;
    background-color: #2563eb;
    color: white;
    padding: 0.75rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #1d4ed8;
}

.btn-download {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background-color: #10b981;
    color: white;
    padding: 0.75rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    margin-top: 0.75rem;
    transition: background-color 0.2s;
}

.btn-download:hover {
    background-color: #059669;
}

.btn-download::before {
    content: "\2193";
    margin-right: 0.5rem;
    font-size: 1.1rem;
}

.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background-color: #6b7280;
    color: white;
    padding: 0.75rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    margin-top: 0.75rem;
    transition: background-color 0.2s;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

.btn-remove {
    background-color: #ef4444;
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-remove:hover {
    background-color: #dc2626;
}

.text-sm {
    font-size: 0.875rem;
    text-align: center;
    color: #4b5563;
    margin-top: 1rem;
}

.text-sm a {
    color: #2563eb;
    text-decoration: none;
}

.text-sm a:hover {
    text-decoration: underline;
}

/* === Feedback Page === */
.feedback-section {
    padding: 2rem 1rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

.feedback-card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1.25rem;
}

/* === Student Row for Penilaian === */
.student-row {
    display: grid;
    grid-template-columns: 50px 100px 150px 1fr 100px 100px 80px;
    gap: 0.75rem;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.student-row:last-child {
    border-bottom: none;
}

.student-row .form-group {
    margin-bottom: 0;
}

.student-row .form-group input,
.student-row .form-group select {
    padding: 0.5rem;
    font-size: 0.9rem;
    width: 100%;
}

.cpmk-fields {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* === Dashboard Page === */
.dashboard-section {
    padding: 2rem 1rem;
}

.card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.list-item {
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem 0;
    font-size: 0.9rem;
}

.list-item p {
    margin: 0;
}

.list-item a {
    color: #2563eb;
    text-decoration: none;
}

.list-item a:hover {
    text-decoration: underline;
}

.list-item-compact {
    padding: 0.5rem;
    font-size: 0.85rem;
    line-height: 1.3;
    border-bottom: 1px solid #d1d5db;
}

.list-item-compact:last-child {
    border-bottom: none;
}

/* === Table === */
.table-logbook {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-top: 1rem;
    overflow-x: auto;
    display: block;
}

.table-logbook th,
.table-logbook td {
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    text-align: left;
}

@media (max-width: 768px) {
    .table-logbook {
        display: table;
    }
    .table-logbook thead {
        display: none;
    }
    .table-logbook tr {
        display: block;
        margin-bottom: 1rem;
        border-bottom: 1px solid #d1d5db;
    }
    .table-logbook td {
        display: block;
        text-align: left;
        position: relative;
        padding: 0.5rem 0.5rem 0.5rem 50%;
        border: none;
        border-bottom: 1px solid #e5e7eb;
    }
    .table-logbook td::before {
        content: attr(data-label);
        position: absolute;
        left: 0.5rem;
        width: 45%;
        font-weight: 600;
    }
    .table-logbook tr:last-child td:last-child {
        border-bottom: none;
    }
}

/* === Pagination === */
.pagination {
    margin-top: 1.5rem;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.pagination a {
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: #2563eb;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
}

.pagination a:hover {
    background-color: #f3f4f6;
}

/* === Stats === */
.stats-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 1rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    min-width: 120px;
    flex: 1;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2563eb;
}

.stat-label {
    font-size: 0.875rem;
    color: #4b5563;
}

/* === Button Add CPMK === */
.btn-add-cpmk {
    padding: 0.5rem 1rem;
    background-color: #10b981;
    color: white;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

.btn-add-cpmk:hover {
    background-color: #059669;
}

/* === Responsive === */
@media (max-width: 1024px) {
    .container {
        max-width: 100%;
        padding: 0 0.75rem;
    }

    .student-row {
        grid-template-columns: 50px 80px 120px 1fr 80px 80px 60px;
    }
}

@media (max-width: 768px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .student-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .student-row .form-group {
        margin-bottom: 0.75rem;
    }

    .cpmk-fields {
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    .navbar .container {
        flex-direction: column;
        align-items: flex-start;
    }

    .navbar-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
        padding: 1rem 0;
    }

    .navbar-menu.active {
        display: flex;
    }

    .navbar-toggle {
        display: block;
        position: absolute;
        top: 1rem;
        right: 1rem;
    }

    .navbar-title {
        font-size: 1rem;
    }

    .navbar-logo img {
        height: 32px;
    }

    .stats-group {
        flex-direction: column;
        align-items: center;
    }

    .stat-item {
        width: 100%;
        max-width: 200px;
    }

    .login-card,
    .card,
    .feedback-card {
        padding: 1rem;
    }

    .login-title,
    .card-title {
        font-size: 1.25rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.5rem;
        font-size: 0.9rem;
    }

    .btn-primary,
    .btn-download,
    .btn-secondary {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 1.125rem;
    }

    .pagination a {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    .dropdown-content {
        min-width: 150px;
        right: 0;
        left: auto;
    }
}