:root {
    --color-sidebar: #0077B6;
    --color-sidebar-dark: #023E5A;
    --color-primary: #00B4D8;
    --color-primary-dark: #0096B8;
    --color-accent: #F77F00;
    --color-accent-dark: #D96E00;
    --color-view: #2E7D32;
    --color-view-dark: #256628;
    --color-bg: #F8F9FA;
    --color-text: #2B2D42;
}

body {
    font-family: "Sarabun", "Noto Sans Thai", system-ui, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--color-text);
    font-weight: 600;
}

a {
    color: var(--color-primary-dark);
}

/* ---------- App shell / sidebar ---------- */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: 250px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--color-sidebar) 0%, var(--color-sidebar-dark) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 1030;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1.35rem 1.25rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar-brand i {
    font-size: 1.4rem;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0.75rem;
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.9rem;
    margin-bottom: 0.2rem;
    border-radius: 0.5rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.95rem;
    border-left: 3px solid transparent;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sidebar-link i {
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
}

.sidebar-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar-link.active {
    background-color: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-weight: 600;
    border-left-color: var(--color-accent);
}

.sidebar-footer {
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    margin-bottom: 0.6rem;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #fff;
    text-decoration: none;
    font-size: 0.9rem;
    opacity: 0.85;
}

.sidebar-logout:hover {
    opacity: 1;
    text-decoration: underline;
}

.app-content {
    flex: 1;
    min-width: 0;
    background-color: var(--color-bg);
}

.sidebar-toggle {
    position: fixed;
    top: 0.85rem;
    left: 0.85rem;
    z-index: 1050;
    background: var(--color-sidebar);
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    width: 42px;
    height: 42px;
    font-size: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1025;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.15);
    }

    .app-sidebar.open {
        transform: translateX(0);
    }

    .sidebar-backdrop.open {
        display: block;
    }

    .app-content {
        padding-top: 3.5rem;
    }
}

/* ---------- Buttons ---------- */

.btn-primary {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    border-radius: 0.5rem;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(0, 180, 216, 0.35);
    transition: transform 0.1s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    box-shadow: 0 4px 10px rgba(0, 180, 216, 0.45);
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: var(--color-primary-dark);
    border-color: var(--color-primary);
    border-radius: 0.5rem;
}

.btn-outline-primary:hover {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-outline-secondary,
.btn-outline-danger {
    border-radius: 0.5rem;
}

.btn {
    border-radius: 0.5rem;
}

/* Edit actions (orange) */
.btn-edit {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
}

.btn-edit:hover,
.btn-edit:focus {
    background-color: var(--color-accent-dark);
    border-color: var(--color-accent-dark);
    color: #fff;
}

.btn-outline-edit {
    color: var(--color-accent-dark);
    border-color: var(--color-accent);
    background-color: transparent;
}

.btn-outline-edit:hover,
.btn-outline-edit:focus {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
}

/* View actions (green) */
.btn-view {
    background-color: var(--color-view);
    border-color: var(--color-view);
    color: #fff;
}

.btn-view:hover,
.btn-view:focus {
    background-color: var(--color-view-dark);
    border-color: var(--color-view-dark);
    color: #fff;
}

.btn-outline-view {
    color: var(--color-view);
    border-color: var(--color-view);
    background-color: transparent;
}

.btn-outline-view:hover,
.btn-outline-view:focus {
    background-color: var(--color-view);
    border-color: var(--color-view);
    color: #fff;
}

/* ---------- Cards / badges ---------- */

.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(43, 45, 66, 0.08), 0 1px 2px rgba(43, 45, 66, 0.06);
}

.card-header {
    background-color: rgba(0, 119, 182, 0.06);
    border-bottom: 1px solid rgba(0, 119, 182, 0.12);
    font-weight: 600;
    border-radius: 0.75rem 0.75rem 0 0 !important;
}

.badge.bg-secondary {
    background-color: var(--color-accent) !important;
}

.badge.bg-info {
    background-color: var(--color-primary) !important;
    color: #fff !important;
}

.table-actions {
    white-space: nowrap;
}

.nav-pills .nav-link {
    color: var(--color-text);
    border-radius: 0.5rem;
}

.nav-pills .nav-link.active {
    background-color: var(--color-primary);
}

.progress-bar {
    background-color: var(--color-primary);
}

/* ---------- Mobile-first expense entry forms (Phase 2) ---------- */

@media (max-width: 480px) {
    .m-form .btn {
        font-size: 1.1rem;
        padding: 0.75rem 1rem;
    }
    .m-form .form-control,
    .m-form .form-select {
        font-size: 1.05rem;
        padding: 0.6rem 0.75rem;
    }
}

/* ---------- /mob field app: fixed top bar + bottom nav shell ---------- */

:root {
    --mob-topbar-h: 56px;
    --mob-bottomnav-h: 64px;
}

.mob-body {
    background-color: var(--color-bg);
    padding-top: var(--mob-topbar-h);
    padding-bottom: calc(var(--mob-bottomnav-h) + env(safe-area-inset-bottom));
}

.mob-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--mob-topbar-h);
    z-index: 1040;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0 0.75rem;
    background: linear-gradient(180deg, var(--color-sidebar) 0%, var(--color-sidebar-dark) 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.mob-logo img {
    height: 34px;
    width: 34px;
    border-radius: 50%;
    display: block;
}

.mob-topbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.mob-user {
    color: #fff;
    font-size: 0.85rem;
    max-width: 30vw;
}

.mob-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    font-size: 1.05rem;
    flex-shrink: 0;
}

.mob-icon-btn:hover,
.mob-icon-btn:focus {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.mob-main {
    min-height: calc(100vh - var(--mob-topbar-h) - var(--mob-bottomnav-h));
    padding-bottom: 1rem;
}

.mob-trip-pill {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.75rem;
    padding: 0.55rem 0.9rem;
    background: #fff;
    border-radius: 2rem;
    box-shadow: 0 1px 3px rgba(43, 45, 66, 0.12);
    color: var(--color-sidebar-dark);
    font-weight: 600;
    text-decoration: none;
    width: fit-content;
}

.mob-trip-pill i.bi-airplane-engines {
    color: var(--color-primary);
}

.mob-bottomnav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    display: flex;
    background: linear-gradient(180deg, var(--color-sidebar) 0%, var(--color-sidebar-dark) 100%);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    padding-bottom: env(safe-area-inset-bottom);
}

.mob-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    height: var(--mob-bottomnav-h);
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 500;
    border-top: 3px solid transparent;
}

.mob-nav-item i {
    font-size: 1.35rem;
}

.mob-nav-item.active {
    color: #fff;
    font-weight: 700;
    border-top-color: var(--color-accent);
}

.mob-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-sidebar-dark);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 1rem 0.75rem 0.5rem;
}

/* ---------- /mob home screen: per-trip sections ---------- */

.mob-trip-section {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(43, 45, 66, 0.1);
    margin: 0 0.75rem 0.9rem;
    overflow: hidden;
}

.mob-trip-section-header {
    padding: 0.85rem 1rem 0.65rem;
}

.mob-trip-section-code {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-sidebar-dark);
}

.mob-trip-section-meta {
    font-size: 0.8rem;
    color: #8a8f98;
}

.mob-action-row {
    display: flex;
    border-top: 1px solid rgba(43, 45, 66, 0.08);
}

.mob-action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.75rem 0.25rem;
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--color-text);
    border-right: 1px solid rgba(43, 45, 66, 0.08);
}

.mob-action-btn:last-child {
    border-right: none;
}

.mob-action-btn i {
    font-size: 1.3rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
}

.mob-action-btn.action-expense i {
    background: var(--color-accent);
}

.mob-action-btn.action-sidenote i {
    background: var(--color-primary);
}

.mob-action-btn.action-participants i {
    background: var(--color-view);
}

.mob-action-btn.action-photos i {
    background: #6f42c1;
}

/* ---------- /mob photo upload page ---------- */

.mob-photo-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    padding: 1rem;
    border-radius: 0.6rem;
    background: #6f42c1;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    border: none;
}

.mob-photo-upload-btn i {
    font-size: 1.4rem;
}

/* ---------- Photo lightbox (admin trip-photo management, desktop + mobile) ---------- */

.photo-thumb {
    cursor: zoom-in;
}

.photo-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(10, 10, 10, 0.94);
    align-items: center;
    justify-content: center;
}

.photo-lightbox.show {
    display: flex;
}

.photo-lightbox-imgwrap {
    max-width: 92vw;
    max-height: 92vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
}

.photo-lightbox-imgwrap img {
    max-width: 92vw;
    max-height: 92vh;
    object-fit: contain;
    transform-origin: center center;
    will-change: transform;
    user-select: none;
    -webkit-user-drag: none;
}

.photo-lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1;
}

.photo-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1;
}

.photo-lightbox-nav:disabled {
    opacity: 0.2;
    cursor: default;
}

.photo-lightbox-prev {
    left: 10px;
}

.photo-lightbox-next {
    right: 10px;
}

/* ---------- Trip tags colored by season (customer trip-history badges) ---------- */

.tag-season-winter {
    background-color: #cdeeff; /* ice */
    color: #045a7c;
}

.tag-season-spring {
    background-color: #d9f2c4; /* young leaves */
    color: #3f6c1f;
}

.tag-season-summer {
    background-color: #1976d2; /* summer sky */
    color: #fff;
}

.tag-season-autumn {
    background-color: var(--color-accent); /* changing leaves */
    color: #fff;
}

.tag-season-none {
    background-color: #e9ecef;
    color: #495057;
}
