/**
 * Ekspedisi Lite - Main Stylesheet
 * Inspired by ATL Form v2 design
 * Mobile-first, responsive, print-friendly
 */

:root {
    --primary: #005AA0;
    --mint: #10b981;
    --ocean: #005AA0;
    --gray: #6b7280;
    --border: #e5e7eb;
    --light: #f3f4f6;
    --dark: #1f2937;
    --danger: #ef4444;
    --sky: #f0f9ff;
}

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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--dark);
    background: #fff;
}

body {
    display: flex;
    flex-direction: column;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 1000;
    transition: bottom 0.3s;
    max-width: 90%;
    text-align: center;
}

.toast.show {
    bottom: 20px;
}

.toast.success { background: var(--mint); }
.toast.error { background: var(--danger); }
.toast.warning { background: #f59e0b; }
.toast.info { background: var(--ocean); }

/* ===== LOGIN PAGE ===== */
.login-page {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--ocean) 0%, #1e40af 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 380px;
}

.login-header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.login-logo {
    font-size: 48px;
    margin-bottom: 12px;
}

.login-header h1 {
    font-size: 28px;
    margin-bottom: 4px;
}

.login-header p {
    font-size: 13px;
    opacity: 0.9;
}

.login-box {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.login-box .field {
    margin-bottom: 16px;
}

.login-box label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 13px;
}

.login-box input {
    width: 100%;
    padding: 10px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.login-box input:focus {
    outline: none;
    border-color: var(--ocean);
    box-shadow: 0 0 0 3px rgba(0, 90, 160, 0.1);
}

/* ===== APP PAGE ===== */
.page {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
}

/* ===== TOPBAR ===== */
.topbar {
    background: var(--ocean);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.topbar-left, .topbar-center, .topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-logo {
    font-size: 18px;
    font-weight: 700;
}

.topbar-center {
    flex: 1;
    text-align: center;
    font-size: 13px;
}

.topbar-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 16px;
    transition: background 0.2s;
}

.topbar-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ===== NAV TABS ===== */
.nav-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 16px;
    background: var(--light);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: sticky;
    top: 50px;
    z-index: 99;
}

.nav-tab {
    padding: 8px 14px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    color: var(--gray);
    transition: all 0.2s;
    font-weight: 500;
}

.nav-tab.active {
    color: var(--ocean);
    border-bottom-color: var(--ocean);
}

/* ===== CONTAINER ===== */
.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
    flex: 1;
}

/* ===== CARDS ===== */
.card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
}

.card-head {
    display: flex;
    gap: 12px;
    padding: 14px;
    border-bottom: 1px solid var(--border);
    align-items: flex-start;
}

.card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 20px;
    flex-shrink: 0;
}

.card-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 2px;
}

.card-sub {
    font-size: 12px;
    color: var(--gray);
    margin-top: 2px;
}

.card-body {
    padding: 14px;
}

/* ===== FORMS ===== */
.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 13px;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 10px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--ocean);
    box-shadow: 0 0 0 3px rgba(0, 90, 160, 0.1);
}

.field textarea {
    resize: vertical;
    line-height: 1.4;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ===== FIELDSETS ===== */
fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

legend {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--dark);
    padding: 0;
}

/* ===== STEPS ===== */
.step-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.step-tab {
    padding: 10px 16px;
    border: 1.5px solid var(--border);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s;
    color: var(--gray);
}

.step-tab.active {
    background: var(--ocean);
    color: white;
    border-color: var(--ocean);
}

.step-pane {
    display: none;
}

.step-pane.active {
    display: block;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: var(--ocean);
    color: white;
}

.btn-primary:hover {
    background: #004080;
    box-shadow: 0 2px 8px rgba(0, 90, 160, 0.2);
}

.btn-mint {
    background: var(--mint);
    color: white;
}

.btn-mint:hover {
    background: #059669;
}

.btn-ocean {
    background: var(--ocean);
    color: white;
}

.btn-ocean:hover {
    background: #004080;
}

.btn-gray {
    background: var(--light);
    color: var(--dark);
    border: 1px solid var(--border);
}

.btn-gray:hover {
    background: #e5e7eb;
}

.btn-outline {
    background: transparent;
    color: var(--ocean);
    border: 1.5px solid var(--ocean);
}

.btn-outline:hover {
    background: rgba(0, 90, 160, 0.05);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

/* ===== MODALS ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.15);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 16px;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--gray);
}

.modal-body {
    padding: 16px;
}

/* ===== STICKY BAR ===== */
.sticky-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 2px solid var(--border);
    padding: 12px 16px;
    z-index: 200;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    max-width: 640px;
    margin: 0 auto;
    left: 50%;
    transform: translateX(-50%);
}

/* ===== LIST ITEMS ===== */
.list-item {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-title {
    font-weight: 600;
    color: var(--dark);
}

.list-item-sub {
    font-size: 12px;
    color: var(--gray);
    margin-top: 4px;
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--mint);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.badge-info {
    background: rgba(0, 90, 160, 0.2);
    color: var(--ocean);
}

/* ===== PRINT STYLES ===== */
@media print {
    .topbar, .nav-tabs, .btn, .modal, .sticky-bar,
    [onclick], [data-no-print] {
        display: none !important;
    }

    .page { height: auto; }
    body { background: white; }
    .card { page-break-inside: avoid; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .topbar { padding: 10px 12px; }
    .topbar-logo { font-size: 16px; }
    .nav-tabs { padding: 8px 12px; }
    .container { padding: 12px; }
    .card-head { gap: 10px; }
    .card-icon { width: 36px; height: 36px; font-size: 18px; }
}
