* {
    text-decoration: none;
    text-transform: none;
    transition: .2s linear;
    font-family: Verdana, Geneva, Tahoma, sans-serif;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #202124;
    margin: 0;
    font-family: Arial, sans-serif;
    color: black;
}

.container {
    text-align: center;
    position: relative;
    /* width: 80vw; */
    height: 80vh;
    border-radius: 5px;
    overflow: hidden;
    background-color: black;
    aspect-ratio: 16/9;
}

canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.imgcanvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
}

.control-button {
    width: 50px;
    height: 50px;
    background-color: #EA4335; /* Red background for off state */
    border: none;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.3s;
}

.control-button.active {
    background-color: #34A853; /* Green background for on state */
}

.control-button:hover {
    background-color: #5f6368;
}

.control-button:active {
    background-color: #70757a;
}

.control-button .material-icons {
    color: white;
    font-size: 24px;
}

.logo {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
    padding: 1rem 3%;
    display: flex;
}

.logo span {
    color: red;
}

.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.5); /* Black background with opacity */
    width: 100%; /* Ensure modal covers the screen */
    height: 100%;
    opacity: 0; /* Start invisible */
    animation: fadeIn 1.5s forwards; /* Apply fadeIn animation */
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

.modal.show {
    display: block;
    animation: fadeIn 0.5s forwards;
}

.modal-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    width: 80%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.modal-content button {
    background-color: #EA4335; /* Green */
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 20px;
}

.modal-content button:hover {
    background-color: #5f6368;
}

.modal-content img {
    width: 350px; /* Atur lebar gambar */
    height: auto; /* Pertahankan rasio aspek gambar */
    margin: 0 auto 15px; /* Auto untuk horizontal centering, dan jarak bawah */
    display: block; /* Agar margin auto berfungsi */
}

.modal-content small {
    display: block;
    margin-top: 15px;
    font-size: 12px;
    color: #777;
    text-align: center;
    margin-bottom: 20px;
}

.modal-content p {
    text-align: center; /* Atur rata kanan-kiri */
    margin-top: 10px;    /* Jarak atas dengan elemen sebelumnya */
    font-size: 14px;     /* Ukuran teks */
    color: #333;         /* Warna teks */
    line-height: 1.6;    /* Jarak antar baris */
    font-weight: bold;

}

.studentmodel {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
}

.studentmodel-content {
  background-color: #fefefe;
  margin: auto;
  /* Ubah margin menjadi auto untuk memusatkan modal */
  padding: 20px;
  border-radius: 8px;
  width: 60%;
  max-width: 700px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  max-height: 80%;
  /* Limit the modal height to allow scrolling */
  position: relative;
  /* Tambahkan posisi relatif untuk penyesuaian */
  top: 50%;
  /* Geser ke tengah vertikal */
  transform: translateY(-50%);
  /* Geser modal ke atas setengah dari tinggi modal untuk memusatkan */
}

.studentmodel-close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.studentmodel-close:hover,
.studentmodel-close:focus {
  color: #000;
}

.studentmodel-header {
  font-size: 2rem;
  /* Ukuran header 2rem */
  font-weight: bold;
  margin-bottom: 10px;
  text-align: center;
  /* Pusatkan teks dalam header */
}

.studentmodel-class {
  font-size: 18px;
  color: #555;
}

.studentmodel-body {
  margin-top: 20px;
  overflow-y: auto;
  /* Ensure scrolling inside the modal body */
  max-height: 60vh;
  /* Set a maximum height for scroll area */
}

.studentmodel-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  margin-bottom: 50px;
  margin-left: -20px;
}

.studentmodel-table th,
.studentmodel-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

.studentmodel-table th {
  background-color: #f2f2f2;
  font-weight: bold;
}

.studentmodel-table-image {
  max-width: 320px;
  height: auto;
  border-radius: 4px;
  transition: transform 0.2s;
}

.studentmodel-table-image:hover {
  transform: scale(1.2);
}

/* ================================
   RESPONSIVE DESIGN - MOBILE STYLES
   ================================ */

/* Tablet styles */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .container {
        width: 95%;
        max-width: 600px;
        /* height: auto; */
        min-height: 400px;
    }

    .logo {
        top: 10px;
        left: 10px;
        font-size: 1.2rem;
        padding: 0.5rem 2%;
    }

    .controls {
        bottom: 15px;
        gap: 15px;
    }

    .control-button {
        width: 45px;
        height: 45px;
    }

    .control-button .material-icons {
        font-size: 20px;
    }

    .modal-content {
        width: 90%;
        max-width: 350px;
        padding: 15px;
    }

    .modal-content img {
        width: 280px;
    }

    .modal-content h2 {
        font-size: 18px;
    }

    .modal-content p {
        font-size: 13px;
    }

    .modal-content button {
        padding: 8px 16px;
        font-size: 14px;
    }

    .studentmodel-content {
        width: 90%;
        max-width: 600px;
        padding: 15px;
        margin: 5% auto;
        max-height: 90vh;
    }

    .studentmodel-header {
        font-size: 1.5rem;
    }

    .studentmodel-class {
        font-size: 16px;
    }

    .studentmodel-body {
        max-height: 70vh;
    }

    .studentmodel-table {
        margin-left: 0;
    }

    .studentmodel-table th,
    .studentmodel-table td {
        padding: 8px;
        font-size: 14px;
    }

    .studentmodel-table-image {
        max-width: 250px;
    }

    .studentmodel-close {
        font-size: 24px;
    }
}

/* Mobile styles */
@media (max-width: 480px) {
    body {
        padding: 0.5rem;
    }

    .container {
        width: 100%;
        /* height: auto; */
        min-height: 300px;
        border-radius: 3px;
    }

    .logo {
        top: 5px;
        left: 5px;
        font-size: 1rem;
        padding: 0.3rem 1%;
    }

    .controls {
        bottom: 10px;
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .control-button {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }

    .control-button .material-icons {
        font-size: 18px;
    }

    .modal-content {
        width: 95%;
        max-width: 300px;
        padding: 12px;
    }

    .modal-content img {
        width: 220px;
    }

    .modal-content h2 {
        font-size: 16px;
        margin-bottom: 15px;
    }

    .modal-content p {
        font-size: 12px;
        line-height: 1.4;
    }

    .modal-content small {
        font-size: 11px;
        margin-top: 10px;
        margin-bottom: 15px;
    }

    .modal-content button {
        padding: 8px 14px;
        font-size: 13px;
        border-radius: 15px;
    }

    .studentmodel-content {
        width: 95%;
        max-width: 100%;
        padding: 10px;
        margin: 2% auto;
        max-height: 95vh;
    }

    .studentmodel-header {
        font-size: 1.3rem;
    }

    .studentmodel-class {
        font-size: 14px;
    }

    .studentmodel-body {
        margin-top: 15px;
        max-height: 75vh;
    }

    .studentmodel-table {
        margin-left: 0;
    }

    .studentmodel-table th,
    .studentmodel-table td {
        padding: 6px;
        font-size: 12px;
    }

    .studentmodel-table-image {
        max-width: 180px;
    }

    .studentmodel-close {
        font-size: 22px;
        padding: 5px;
    }

    /* Make table scrollable horizontally on very small screens */
    .studentmodel-body {
        overflow-x: auto;
    }

    .studentmodel-table {
        min-width: 400px;
    }
}

/* Extra small mobile devices */
@media (max-width: 320px) {
    .container {
        min-height: 250px;
    }

    .logo {
        font-size: 0.9rem;
    }

    .control-button {
        width: 35px;
        height: 35px;
        min-width: 35px;
        min-height: 35px;
    }

    .control-button .material-icons {
        font-size: 16px;
    }

    .modal-content {
        width: 98%;
        padding: 10px;
    }

    .modal-content img {
        width: 180px;
    }

    .modal-content h2 {
        font-size: 14px;
    }

    .modal-content p {
        font-size: 11px;
    }

    .modal-content button {
        padding: 6px 12px;
        font-size: 12px;
    }

    .studentmodel-content {
        width: 98%;
        padding: 8px;
    }

    .studentmodel-header {
        font-size: 1.1rem;
    }

    .studentmodel-class {
        font-size: 12px;
    }

    .studentmodel-table th,
    .studentmodel-table td {
        padding: 4px;
        font-size: 11px;
    }

    .studentmodel-table-image {
        max-width: 150px;
    }
}

/* Landscape mobile orientation */
@media (max-width: 768px) and (orientation: landscape) {
    /* .container {
        height: 80vh;
        min-height: 300px;
    } */

    .controls {
        bottom: 8px;
    }

    .modal-content {
        margin: 5% auto;
        max-height: 80vh;
        overflow-y: auto;
    }

    .studentmodel-content {
        margin: 2% auto;
        max-height: 85vh;
    }
}

/* Touch improvements for mobile */
@media (max-width: 768px) {
    .control-button,
    .modal-content button,
    .studentmodel-close {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        touch-action: manipulation;
    }

    /* Improve modal positioning on mobile */
    .modal {
        align-items: center;
        justify-content: center;
        padding: 1rem;
    }

    .studentmodel {
        padding: 1rem;
    }

    /* Better scrolling for tables */
    .studentmodel-body::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }

    .studentmodel-body::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 3px;
    }

    .studentmodel-body::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 3px;
    }

    .studentmodel-body::-webkit-scrollbar-thumb:hover {
        background: #555;
    }
}

/* Fix for iOS Safari viewport units */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 768px) {
        .container {
            height: -webkit-fill-available;
            min-height: -webkit-fill-available;
        }

        .studentmodel-content {
            max-height: 90vh;
            max-height: -webkit-fill-available;
        }
    }
}

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

.loading-modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.loading-modal-content h3 {
    margin: 20px 0 10px 0;
    color: #333;
    font-size: 1.5em;
}

.loading-modal-content p {
    margin: 10px 0 20px 0;
    color: #666;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

.loading-progress {
    width: 100%;
    height: 6px;
    background-color: #f3f3f3;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 20px;
}

.loading-bar {
    height: 100%;
    background-color: #3498db;
    border-radius: 3px;
    animation: loading-progress 2s ease-in-out infinite;
}

@keyframes loading-progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Disabled button styling */
.control-button:disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
    background-color: #666 !important;
}

.control-button:disabled:hover {
    background-color: #666 !important;
    transform: none !important;
}
