/* =========================================================
   SILAPORSEHAT - RESPONSIVE USER / PEGAWAI LOGBOOK STYLES
   ========================================================= */

.app-bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #F4F7F6 0%, #E2E8F0 100%);
    z-index: -1;
}

/* Responsive Wrapper: Adapt between HP Mobile & Desktop Laptop */
.app-wrapper {
    width: 100%;
    margin: 0 auto;
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-body);
    transition: all 0.3s ease;
}

/* Desktop & Laptop Screen Layout (>= 768px) */
@media (min-width: 768px) {
    .app-wrapper {
        max-width: 1100px;
        min-height: calc(100vh - 40px);
        margin: 20px auto;
        border-radius: 24px;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
        border: 1px solid var(--border);
        overflow: hidden;
    }

    .screen {
        padding: 30px 40px !important;
    }

    /* Grid for Desktop Cards */
    #logbook-container, .logbook-grid-desktop {
        display: grid !important;
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
        gap: 16px !important;
    }

    .jam-card {
        margin-bottom: 0 !important;
        height: 100%;
    }

    /* Hide Mobile Bottom Nav on Desktop, Show Modern Top Header */
    .bottom-nav {
        display: none !important;
    }

    .desktop-top-nav {
        display: flex !important;
    }
}

/* Mobile Screen Layout (< 768px) */
@media (max-width: 767px) {
    .app-wrapper {
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        border: none;
    }

    .screen {
        padding: 16px;
        padding-top: max(20px, calc(12px + env(safe-area-inset-top, 0px)));
        padding-bottom: max(110px, calc(100px + env(safe-area-inset-bottom, 0px)));
    }

    .bottom-nav {
        display: flex !important;
    }
}

.screen {
    display: none;
    flex: 1;
    flex-direction: column;
    width: 100%;
    animation: fadeIn 0.3s ease-out;
    overflow-y: auto;
}

.screen.active {
    display: flex;
}

#screen-login {
    justify-content: center;
    align-items: center;
    padding: 24px 16px;
}

.login-card-container {
    width: 100%;
    max-width: 440px;
    margin: auto;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 24px;
    padding: 28px 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

#screen-splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    justify-content: center;
    align-items: center;
    background: var(--bg-body);
}

.splash-logo-container {
    width: 110px;
    height: 110px;
    border-radius: 28px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px var(--primary-shadow-color);
    animation: pulse 2s infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(0.96); box-shadow: 0 0 20px var(--primary-rgba-15); }
    100% { transform: scale(1.04); box-shadow: 0 0 40px var(--primary-rgba-40); }
}

.splash-title {
    margin-top: 28px;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    text-align: center;
}

.splash-subtitle {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    max-width: 380px;
    line-height: 1.4;
}

.splash-loader {
    margin-top: 40px;
    width: 36px;
    height: 36px;
    border: 3.5px solid var(--border);
    border-top: 3.5px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

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

.network-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.network-status-pill:hover {
    border-color: var(--teal);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-dot.offline {
    background-color: var(--warning);
    box-shadow: 0 0 8px var(--warning);
}

.app-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    margin-bottom: 16px;
}

.app-bar-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
}

.app-bar-action {
    background: none;
    border: none;
    color: var(--teal);
    font-size: 20px;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: background 0.2s;
}
.app-bar-action:hover {
    background: rgba(0, 166, 118, 0.08);
}

.right-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.right-nav-overlay.active {
    display: block;
    opacity: 1;
}

.right-nav-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    max-width: 85%;
    height: 100%;
    background: var(--bg-card);
    z-index: 1001;
    box-shadow: -4px 0 25px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.right-nav-drawer.active {
    transform: translateX(0);
}

.drawer-header {
    padding: 24px 20px 18px 20px;
    background: linear-gradient(135deg, var(--teal-dark), var(--primary));
    color: #FFFFFF;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.drawer-user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #FFFFFF;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.drawer-menu {
    list-style: none;
    padding: 16px 12px;
    flex: 1;
    overflow-y: auto;
}
.drawer-menu li {
    margin-bottom: 6px;
}
.drawer-menu a, .drawer-menu button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 600;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}
.drawer-menu a:hover, .drawer-menu button:hover {
    background: var(--bg-surface);
    color: var(--primary);
}

.bottom-nav {
    position: fixed;
    bottom: max(12px, env(safe-area-inset-bottom, 12px));
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 24px);
    max-width: 500px;
    height: 66px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 22px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 4px 6px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    z-index: 99;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-hint);
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    gap: 3px;
    background: none;
    border: none;
    cursor: pointer;
    flex: 1;
    height: 52px;
    border-radius: 14px;
    transition: all 0.2s;
    position: relative;
}

.bottom-nav-item .svg-icon {
    width: 20px;
    height: 20px;
}

.bottom-nav-item.active {
    color: var(--primary);
    background: rgba(0, 200, 83, 0.12);
    border: 1px solid rgba(0, 200, 83, 0.3);
}

.brand-header-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 18px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.brand-logo-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    flex-shrink: 0;
    box-shadow: 0 4px 14px var(--primary-shadow-color);
}

.min3-target-widget {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.min3-target-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.target-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.target-badge.warning {
    background: rgba(255, 152, 0, 0.15);
    color: #d97706;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.target-badge.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.target-progress-track {
    height: 10px;
    background: var(--bg-surface);
    border-radius: 6px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.target-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--warning), var(--primary));
    border-radius: 6px;
    width: 0%;
    transition: width 0.5s ease-out;
}

.jam-card {
    background-color: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.jam-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(0, 166, 118, 0.08);
}

.jam-card.terisi {
    border-color: var(--border-light);
}

.jam-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.jam-badge {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.modal-content {
    background-color: var(--bg-card);
    border-top: 2px solid var(--border-light);
    border-radius: 24px 24px 0 0;
    padding: 24px;
    padding-bottom: max(32px, env(safe-area-inset-bottom, 16px));
    max-height: 92vh;
    width: 100%;
    max-width: 650px;
    margin: 0 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
    position: relative;
    z-index: 100000;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.foto-preview-box {
    width: 100%;
    height: 180px;
    background: var(--bg-surface);
    border: 2px dashed var(--border);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.foto-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
