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

html, body {
    height: 100%;
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
}

/* ==============================
   Login / Signup Pages
============================= */
body.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

body.login-page .container {
    flex-shrink: 0;
}

.container {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    width: 90%;
    max-width: 380px;
    text-align: center;
}

.container h2 {
    margin-bottom: 20px;
}

input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-size: 16px;
}

button {
    width: 100%;
    padding: 12px;
    background-color: #1976d2;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s ease-in-out;
    font-size: 16px;
}

button:hover {
    background-color: #1565c0;
}

.error-message {
    color: red;
    font-size: 0.9em;
    margin-top: 10px;
}

a {
    color: #1976d2;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ==============================
   Dashboard Page
============================= */
body.dashboard-page {
    display: block;
    padding: 20px;
}

header {
    background-color: #1976d2;
    color: white;
    padding: 20px;
    text-align: center;
    border-radius: 10px 10px 0 0;
    margin-bottom: 20px;
    font-size: 18px;
}

.dashboard-container {
    max-width: 1100px;
    margin: auto;
}

/* ==============================
   Cards
============================= */
.card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.card h2 {
    color: #1976d2;
    margin-bottom: 15px;
}

/* ==============================
   Flex Utilities
============================= */
.flex {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.flex > div {
    flex: 1;
    min-width: 250px;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ==============================
   Calendar / Tabs / Sessions
============================= */
.calendar {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.day {
    background: #f1f1f1;
    border-radius: 8px;
    padding: 10px;
    max-height: 500px;
    overflow-y: auto;
}

.day h4 {
    font-size: 14px;
    margin-bottom: 5px;
    color: #333;
    text-align: center;
}

/* IMPORTANT: make session wrap */
.session {
    background-color: #f9f9f9;
    border-left: 4px solid #1976d2;
    border-radius: 4px;
    font-size: 14px;
    display: flex;
    flex-wrap: wrap;           /* <-- allows wrapping */
    justify-content: space-between;
    padding: 10px 12px;
    margin: 12px 0;
    border-bottom: 1px solid #ddd;
    align-items: center;
    gap: 10px;
}

.session-text {
    flex: 1;
}

/* Button group */
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

/* ==============================
   Tabs
============================= */
.tab {
    display: inline-block;
    padding: 10px 20px;
    cursor: pointer;
    background-color: #eee;
    margin-right: 5px;
    border-radius: 5px 5px 0 0;
    border: 1px solid #ccc;
    transition: all 0.2s ease-in-out;
}

.tab:hover {
    background-color: #ddd;
}

.tab.active {
    background-color: #4285f4;
    color: #fff;
    font-weight: bold;
    border-bottom: 1px solid white;
}

.tab-content {
    display: none;
    margin-top: 20px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 0 0 5px 5px;
    background-color: #fff;
}

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

/* ==============================
   QR Code
============================= */
.qr-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

#generatedCode {
    margin-bottom: 15px;
    font-weight: bold;
}

/* ==============================
   Buttons
============================= */
.dashboard-button {
    width: auto;
    padding: 10px 20px;
    margin: 5px;
    background-color: #1976d2;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.dashboard-button:hover {
    background-color: #1565c0;
}

/* ==============================
   Utility Classes
============================= */
.text-center {
    text-align: center;
}

.mt-10 { margin-top: 10px; }
.mb-10 { margin-bottom: 10px; }

/* ==============================
   Schedule Popup
============================= */
#schedulePopup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0,0,0,0.3);
    z-index: 1000;
    max-width: 320px;
}

#schedulePopup::before {
    content: "";
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.3);
    z-index: -1;
}

#schedulePopup button {
    margin-top: 10px;
    padding: 5px 10px;
    cursor: pointer;
}

/* ==============================
   File input / upload status
============================= */
#scheduleFile { display: none; }
#uploadStatus { margin-top: 10px; font-size: 0.9em; }
#qrCodeCard { text-align: center; }
#popupClose { margin-top: 10px; padding: 5px 10px; cursor: pointer; }

.schedule-btn {
    margin-left: 10px;
    padding: 2px 5px;
}

/* NEW: Calendar buttons size */
.session button {
    padding: 12px 16px;
    font-size: 14px;
    min-width: 130px;
    height: 48px;
    text-align: center;
    white-space: nowrap;
    border-radius: 6px;
    background-color: #007BFF;
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.session button:hover {
    background-color: #0056b3;
}


/* ── manual period allocation ── */
.manual-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

/* ── Labels ── */
.manual-field label {
    font-size: 0.85em;
    font-weight: 600;
    color: #555;
}

/* ── Inputs & selects ── */
.manual-field select,
.manual-field input[type="date"] {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.95em;
    background: #fff;
    width: 100%;
    box-sizing: border-box;
}

/* ── Focus state ── */
.manual-field select:focus,
.manual-field input[type="date"]:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

/* ==============================
   MOBILE RESPONSIVENESS
============================= */
@media (max-width: 768px) {

    body.dashboard-page {
        padding: 10px;
    }

    .flex > div {
        min-width: 100%;
    }

    .calendar {
        grid-template-columns: repeat(2, 1fr);
    }

    .day {
        max-height: 350px;
    }
}

@media (max-width: 480px) {

    .container {
        padding: 20px;
    }

    .calendar {
        grid-template-columns: repeat(1, 1fr);
    }

    .day {
        max-height: 300px;
    }

    header {
        padding: 15px;
        font-size: 16px;
    }

    /* Mobile button wrap fix */
    .button-group {
        max-width: 100%;
    }

    .session button {
        min-width: 100px;
        font-size: 13px;
        height: 46px;
        padding: 10px 12px;
    }
}
