/* Global style */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    color-scheme: light;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #0f172a;
    background-color: #eef2ff;
    --surface: #ffffff;
    --surface-strong: #f9fafb;
    --border: #e5e7eb;
    --muted: #6b7280;
    --text-muted: #475569;
    --primary: #2563eb;
    --accent: #60a5fa;
    --shadow: 0 18px 60px rgba(15, 23, 42, 0.07);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top, rgba(37, 99, 235, 0.1), transparent 28%),
                radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.06), transparent 22%),
                #f1f5f9;
    color: var(--text-muted);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; }

/* ── Topbar ── */
.topbar {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 18px 22px;
    margin: 10px auto 18px;
    max-width: 1180px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255,255,255,0.97), rgba(250,250,255,0.92));
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.window-dots {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 9px;
}

.window-dots span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: block;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset;
}

.window-dots span:nth-child(1) { background: #f87171; }
.window-dots span:nth-child(2) { background: #fbbf24; }
.window-dots span:nth-child(3) { background: #34d399; }

.topbar h1 {
    margin: 0;
    font-size: clamp(1.1rem, 1.5vw, 1.6rem);
    color: #0f172a;
    line-height: 1.1;
    font-weight: 700;
}

.topbar p {
    margin: 4px 0 0;
    font-size: 0.8125rem;
    color: #94a3b8;
}

.topbar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.topbar a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 14px;
    text-decoration: none;
    color: #374151;
    background: rgba(255,255,255,0.9);
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.07);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.14s ease;
}

.topbar a:hover {
    transform: translateY(-1px);
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.09);
    color: #0f172a;
}

.topbar a.active {
    color: #2563eb;
    background: #eff6ff;
    border-color: rgba(37, 99, 235, 0.25);
    font-weight: 600;
}

/* ── Layout ── */
.container {
    max-width: 1200px;
    margin: 0 auto 32px;
    padding: 0 18px;
}

/* ── Cards ── */
.card {
    background: var(--surface);
    border-radius: 18px;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04), 0 8px 28px rgba(15, 23, 42, 0.04);
    padding: 22px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.07), 0 12px 36px rgba(15, 23, 42, 0.06);
}

.card h2 {
    margin-top: 0;
    margin-bottom: 16px;
    color: #0f172a;
    font-size: 0.9375rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 11px;
}

/* Section icon chips */
.card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.card-icon svg { width: 18px; height: 18px; }

.card-icon-bp  { background: linear-gradient(135deg, #fca5a5, #dc2626); }
.card-icon-hr  { background: linear-gradient(135deg, #f9a8d4, #db2777); }
.card-icon-med { background: linear-gradient(135deg, #6ee7b7, #059669); }
.card-icon-act { background: linear-gradient(135deg, #fed7aa, #ea580c); }
.card-icon-sym { background: linear-gradient(135deg, #c4b5fd, #7c3aed); }
.card-icon-log { background: linear-gradient(135deg, #93c5fd, #1d4ed8); }
.card-icon-set { background: linear-gradient(135deg, #cbd5e1, #475569); }

/* backward compat for old .pill used in log.php */
.pill {
    display: inline-block;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), rgba(96,165,250,0.6));
    flex-shrink: 0;
}

.card p, .card label, .card li { color: #475569; }

/* ── Forms ── */
label {
    display: block;
    margin-bottom: 14px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
    letter-spacing: 0.01em;
}

input[type="number"],
input[type="date"],
input[type="time"],
input[type="text"],
select,
textarea {
    width: 100%;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 13px;
    margin-top: 6px;
    font-size: 0.9375rem;
    font-family: inherit;
    background: #f9fafb;
    color: #0f172a;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #2563eb;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    background: #f1f5f9;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M6 8l4 4 4-4' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    background-size: 18px;
    padding-right: 36px;
    cursor: pointer;
}

textarea {
    min-height: 90px;
    resize: vertical;
}

.form-card button[type="submit"] {
    width: 100%;
    margin-top: 4px;
}

/* Arm toggle (tangan kanan / kiri) */
.arm-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.arm-toggle label {
    flex: 1;
    margin-bottom: 0;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    color: #374151;
}

.arm-toggle input[type="radio"] {
    display: none;
}

.arm-toggle input[type="radio"] + span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.14s ease;
    width: 100%;
    text-align: center;
    cursor: pointer;
}

.arm-toggle input[type="radio"]:checked + span {
    background: #eff6ff;
    border-color: #2563eb;
    color: #2563eb;
    font-weight: 600;
}

/* 3-column grid for desktop */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

/* ── Buttons ── */
button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: none;
    border-radius: 10px;
    padding: 8px 18px;
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

button:hover,
.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.28);
}

button:active,
.button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
}

/* ── Flash / Alert messages ── */
.flash-message {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* ── Grid helpers ── */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.actions-row,
.filter-row,
.mobile-field-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.actions-row { margin-top: 16px; }

/* ── Filter row (log & settings) ── */
.filter-row a {
    padding: 7px 14px;
    background: #f1f5f9;
    color: #374151;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1px solid transparent;
    transition: all 0.14s ease;
}

.filter-row a.active,
.filter-row a:hover {
    background: #2563eb;
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.22);
}

/* ── Summary grid (log page) ── */
.summary-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 12px;
    margin-top: 4px;
}

.summary-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 14px 16px;
    border-radius: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: all 0.15s ease;
}

.summary-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    border-color: #bfdbfe;
    background: #eff6ff;
}

.summary-item strong {
    display: block;
    margin-bottom: 4px;
    color: #0f172a;
    font-size: 0.8rem;
    font-weight: 600;
}

.summary-item span {
    font-size: 1.6rem;
    font-weight: 800;
    color: #2563eb;
    line-height: 1;
}

/* ── Table ── */
.table-wrapper { overflow-x: auto; border-radius: 10px; }

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    min-width: 740px;
}

th, td {
    text-align: left;
    padding: 11px 14px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.85rem;
}

th {
    color: #374151;
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8fbff; }

/* ── Feature list ── */
.feature-list {
    padding-left: 20px;
    margin: 0;
}

.feature-list li {
    margin-bottom: 10px;
    line-height: 1.65;
    font-size: 0.9rem;
}

/* ── PC grid layout ── */
.pc-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.pc-grid .card { min-height: 260px; }

/* ── Mobile-specific ── */
body.mobile {
    background: linear-gradient(180deg, #ffffff, #f1f5f9 60%);
    padding-bottom: 80px;
}

body.mobile .topbar {
    margin: 0;
    border-radius: 0 0 24px 24px;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
    border: none;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(20px);
    padding: 16px 14px 14px;
}

body.mobile .window-dots { display: none; }

body.mobile .topbar h1 { font-size: 1.1rem; }
body.mobile .topbar p { font-size: 0.75rem; }

.mobile-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding-bottom: 4px;
}

.mobile-bar nav {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.mobile-container {
    padding-top: 10px;
    max-width: 720px;
}

.mobile-card {
    border-radius: 20px;
    padding: 18px;
    border: 1px solid rgba(229, 231, 235, 0.8);
    background: #ffffff;
}

.mobile-card h2 { margin-bottom: 14px; }
.mobile-field-row { flex-direction: column; }
.mobile-card button { width: 100%; margin-top: 6px; }

/* ── Mobile bottom nav ── */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(18px);
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: stretch;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: #9ca3af;
    font-size: 0.6875rem;
    font-weight: 500;
    transition: color 0.14s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-bottom-nav a.active { color: #2563eb; }
.mobile-bottom-nav a:hover { color: #374151; }

.icon-sm { width: 22px; height: 22px; }

/* ── Mobile log cards ── */
.log-cards { display: none; margin-top: 12px; }

.log-card {
    background: var(--surface);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
    border: 1px solid var(--border);
}

.log-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.log-card-title {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.875rem;
}

.log-card-time {
    font-size: 0.75rem;
    color: var(--muted);
}

.log-row {
    margin-bottom: 5px;
    font-size: 0.85rem;
}

.log-card-foot {
    font-size: 0.72rem;
    color: #9aa0b4;
    margin-top: 8px;
}

/* ── Responsive breakpoints ── */
@media (max-width: 960px) {
    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .grid-2,
    .pc-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    table { display: none; }
    .log-cards { display: block; }
    .summary-list { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 901px) {
    body.desktop {
        background: #dde3ec;
    }

    .desktop .container {
        padding-top: 16px;
    }

    .desktop .topbar {
        margin: 28px auto 20px;
        border-radius: 28px;
        padding: 22px 28px;
    }

    .window-dots {
        left: 28px;
    }
}

@media (max-width: 680px) {
    .topbar { padding: 16px 14px; }
    .topbar nav { gap: 6px; }
    .card { padding: 16px; }

    input[type="number"],
    input[type="date"],
    input[type="time"],
    input[type="text"],
    select,
    textarea {
        padding: 11px 13px;
    }
}
