/* ==========================================
   TIMEWISE Responsive System
========================================== */

* {
    box-sizing: border-box;
}

img {
    max-width: 100%;
    height: auto;
}

body {
    overflow-x: hidden;
}

main {
    width: 100%;
}

/* Smooth animation */

/* ==========================================
   Tablet
========================================== */

@media (max-width: 992px) {

    .summary-card {

        width: calc(50% - 20px);

    }

}

/* ==========================================
   Mobile
========================================== */

@media (max-width: 768px) {

    .main-content {

        margin-left: 0;

        padding: 0.9rem 0.85rem calc(104px + env(safe-area-inset-bottom));

    }

    .mobile-bottom-nav {

        padding-bottom: env(safe-area-inset-bottom);

    }

    .mobile-bottom-nav .nav-item {

        min-height: 44px;

    }

    .topbar h2 {

        font-size: var(--font-size-2xl, 1.5rem);

    }

    .summary-card {

        width: 100%;

    }

    table {

        display: block;

        overflow-x: auto;

        white-space: nowrap;

    }

    .calendar-table {

        font-size: 12px;

    }

    .calendar-day {

        font-size: 13px;

    }

    .task-card {

        width: 100%;

    }

    .top-header {
        padding: 0 1rem;
    }

    .header-right .user-info {
        display: none;
    }

    .mobile-dropdown {
        display: none;
    }

    .mobile-dropdown.open {
        display: block;
    }

    .top-header {
        left: 0;
    }
}

/* ==========================================
   Mobile Bottom Navigation
========================================== */

.mobile-nav {

    position: fixed;

    bottom: 0;

    left: 0;

    width: 100%;

    height: 72px;

    background: var(--bg-surface);

    display: none;

    justify-content: space-around;

    align-items: center;

    border-top: 1px solid var(--border-color);

    z-index: 999;

    box-shadow: 0 -4px 16px rgba(15,23,42,.08);

    padding-bottom: env(safe-area-inset-bottom);

}

.mobile-nav a {

    text-decoration: none;

    color: var(--text-muted);

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    gap: 4px;

    font-size: 11px;

    font-weight: 500;

    flex: 1;

    height: 100%;

    transition: color var(--transition-speed);

}

.mobile-nav a.active {

    color: var(--primary-color);

}

.mobile-nav i {

    font-size: 20px;

}

.mobile-nav .add-button {

    width: 56px;

    height: 56px;

    background: var(--brand-gradient);

    color: #fff;

    border-radius: 50%;

    display: flex;

    justify-content: center;

    align-items: center;

    margin-top: -26px;

    font-size: 22px;

    box-shadow: 0 8px 18px rgba(var(--primary-rgb), .35);

    flex: 0 0 auto;

}

.mobile-nav .add-button:active {

    transform: scale(.94);

}

.mobile-nav .add-button span {

    display: none;

}

@media (max-width:768px){

    .mobile-nav{

        display:flex;

    }

}

/* ==========================================
   Small phones (approx. 320–480px)
   ========================================== */

@media (max-width: 480px) {

    .topbar {
        margin-bottom: var(--space-4, 1rem);
    }

    .topbar h2 {
        font-size: var(--font-size-xl, 1.25rem);
    }

    .form-actions {
        display: flex;
        flex-direction: column;
        gap: 0.6rem;
    }

    .form-actions .btn {
        width: 100%;
    }

    /* Comfortable touch targets for primary controls. */
    .btn {
        min-height: 44px;
    }

    .btn-lg {
        min-height: 48px;
        font-size: 1rem;
    }

    /* Camera modals must fit portrait phones. */
    .camera-modal {
        padding: 10px;
    }

    .camera-modal-box {
        max-width: 100%;
        padding: 14px;
    }

    /* Session history / tables scroll within their own card, not the page. */
    .table-scroll {
        margin-left: -0.85rem;
        margin-right: -0.85rem;
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }

    .ojt-clock-value {
        font-size: clamp(1.9rem, 11vw, 2.6rem);
    }

    .ojt-controls .btn {
        width: 100%;
    }
}
