body {
    background-image: url('background.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    overflow-x: hidden;
}

/* Navbar Styles */
.navbar {
    background-color: transparent !important;
    box-shadow: none;
    padding: 0.5rem 1rem;
    position: relative; /* Needed for ::before overlay */
    z-index: 1;
}

/* Gradient overlay for readability */
.navbar::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3), transparent);
    z-index: -1;
}

/* Green theme override for navbar background */
.navbar-dark.bg-primary {
    background-color: #28a745 !important;
}

/* Navbar Toggler customization */
.navbar-toggler {
    outline: none;
    border: none;
    z-index: 2;
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba%28255,255,255,1%29' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

/* Navbar Brand */
.navbar-brand {
    display: flex;
    align-items: center;
    font-size: 1.75rem;
    font-weight: bold;
}

.navbar-logo {
    height: 40px;
    margin-right: 10px;
}

/* Nav Links */
.navbar-nav .nav-link {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    padding: 0.5rem 1rem;
    margin-left: 1rem;
    transition: all 0.3s ease;
    color: white;
    border: 1px solid white;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Responsive dropdown style for mobile */
@media (max-width: 992px) {
    .navbar-nav {
        /* background-color: rgba(0, 0, 0, 0.6); */
        border-radius: 10px;
        padding: 2rem;
    }

    .navbar-nav .nav-link {
        margin: 0.5rem 0;
        text-align: center;
    }
}

/* Container */
.container {
    background-color: transparent;
    border-radius: 10px;
    padding: 20px;
    margin-top: 5px;
    box-shadow: none;
}

/* Modal size adjustments */
.modal-dialog {
    max-width: 500px; /* Standard size for regular modals */
    margin: 1.75rem auto;
}

/* Camera Modal specific sizing */
#cameraModal .modal-dialog {
    max-width: 600px; /* Slightly larger for camera but not too big */
    margin: 1.75rem auto;
}

/* Student selection modal adjustments */
#studentModal .modal-dialog {
    max-width: 400px; /* Smaller for just a dropdown */
    margin: 1.75rem auto;
}

/* Time Display */
.time-display {
    text-align: center;
    font-size: 5rem;
    font-weight: bold;
    margin: 20px 0;
    margin-top: 100px;
    margin-bottom: 20px;
    padding: 20px;
    border-radius: 5px;
    color: #ffffff;
    text-shadow: 
        -2px -2px 0 #000,  
         2px -2px 0 #000,
        -2px  2px 0 #000,
         2px  2px 0 #000;
}

/* Main Buttons */
.main-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    align-items: center;
    margin-top: 2rem;
    margin-bottom: 2rem;
    background: transparent;
}

.main-buttons .btn-success {
    padding: 1rem 3rem;
    font-size: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    width: 200px;
    background-color: #28a745 !important;
    border-color: #28a745 !important;
}

.main-buttons .btn-danger {
    padding: 1rem 3rem;
    font-size: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    width: 200px;
}

/* Camera */
.camera-container {
    width: 100%;
    height: 300px; /* Reduced height */
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-align: center;
}

#video, #canvas {
    width: 100%; /* Changed from 50% to 100% for better visibility */
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
    transform: scaleX(-1);
}

#canvas {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
}

/* Success Message */
.success-message {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: auto;
    max-width: 400px;
    z-index: 9999;
    animation: fadeIn 0.5s, fadeOut 0.5s 2.5s;
}

@keyframes fadeIn {
    from {opacity: 0;}
    to {opacity: 1;}
}

@keyframes fadeOut {
    from {opacity: 1;}
    to {opacity: 0;}
}

/* Modal */
.modal-header.bg-primary {
    background-color: #28a745 !important;
}

.modal-content {
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    padding: 0; /* Remove any extra padding */
}

/* Modal body padding adjustments */
.modal-body {
    padding: 1rem;
}

.btn-primary {
    background-color: #28a745 !important;
    border-color: #28a745 !important;
}

/* Camera Modal Buttons */
#captureBtn, #saveAttendanceBtn {
    padding: 0.5rem 1.5rem;
    margin: 0 0.5rem;
}

/* Student Dropdown */
#studentSelect {
    border: 1px solid #ced4da;
    border-radius: 5px;
    padding: 10px;
}

/* Alert Styling */
.alert-success {
    background-color: rgba(40, 167, 69, 0.9);
    color: white;
    font-weight: bold;
    border: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 18px;
    }
    .main-buttons {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .main-buttons .btn {
        width: 80%;
        width: 100%;
        max-width: 300px;
        padding: 12px;
        font-size: 16px;
    }

    .time-display {
        font-size: 1.5rem;
        padding: 15px;
    }

    .camera-container {
        height: 250px; /* Even smaller height on mobile */
    }
    
    #cameraModal .modal-dialog,
    #studentModal .modal-dialog,
    .modal-dialog {
        max-width: 90%; /* Use percentage width on smaller screens */
        margin: 1rem auto;
    }

    .modal-content {
        padding: 10px;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 10px;
    }

    .navbar-logo {
        height: 30px;
    }
}