/* ===== RESET & BASE ===== */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: #f0f0f0;
    margin: 0;
    padding: 0;
    padding-top: 56px; /* space for navbar */
    font-size: 15px;
    -webkit-text-size-adjust: 100%;
}

/* ===== NAVBAR ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.nav-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    text-decoration: none;
    color: white;
    font-size: 20px;
    transition: background 0.2s;
}
.nav-back:hover { background: rgba(255,255,255,0.25); }

.nav-title {
    flex: 1;
    color: white;
    font-size: 15px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-home {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    text-decoration: none;
    color: white;
    font-size: 18px;
    transition: background 0.2s;
}
.nav-home:hover { background: rgba(255,255,255,0.25); }

/* ===== CONTAINER ===== */
.container {
    max-width: 600px;
    background: white;
    margin: 10px auto;
    padding: 16px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* ===== HEADING ===== */
h2 {
    font-size: 18px;
    margin: 0 0 6px 0;
    line-height: 1.3;
}

h3 {
    font-size: 16px;
    margin: 0 0 6px 0;
}

/* ===== FORM ELEMENTS ===== */
label {
    display: block;
    font-weight: bold;
    margin-top: 10px;
    margin-bottom: 3px;
    font-size: 14px;
}

input, textarea, select, button {
    width: 100%;
    padding: 12px 10px;
    margin: 4px 0 8px 0;
    border-radius: 6px;
    border: 1px solid #ccc;
    box-sizing: border-box;
    font-size: 16px; /* mencegah iOS auto-zoom */
    font-family: Arial, sans-serif;
}

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

select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3cpath fill='%23666' d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
    padding-right: 36px;
}

button {
    background: #4CAF50;
    color: white;
    border: none;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    padding: 14px 10px;
    margin-top: 10px;
    min-height: 48px; /* touch target minimum */
    transition: background 0.2s;
}

button:hover, button:active {
    background: #45a049;
}

/* ===== NAVIGASI LINK ===== */
hr {
    margin: 16px 0;
    border: none;
    border-top: 1px solid #e0e0e0;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.nav-links a, a.nav-btn {
    display: inline-block;
    padding: 10px 14px;
    background: #f0f0f0;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    min-height: 44px;
    line-height: 24px;
}

.nav-links a:hover, a.nav-btn:hover {
    background: #e0e0e0;
}

/* ===== ALERT SUCCESS / ERROR ===== */
.success {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    margin-top: 15px;
    border-radius: 6px;
    font-size: 15px;
    line-height: 1.5;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    margin-top: 15px;
    border-radius: 6px;
    font-size: 15px;
    line-height: 1.5;
}

/* ===== KUPON ===== */
.kupon {
    max-width: 400px;
    margin: auto;
    background: white;
    padding: 20px 16px;
    border: 2px dashed #4CAF50;
    text-align: center;
    border-radius: 15px;
}

.kupon svg {
    max-width: 100%;
    height: auto;
}

.nama-penerima {
    font-size: 18px;
    font-weight: bold;
    margin-top: 15px;
    border-top: 1px solid #ccc;
    padding-top: 10px;
    word-break: break-word;
}

.kode-text {
    font-family: monospace;
    font-size: 14px;
    margin: 10px 0;
    word-break: break-all;
}

.status {
    margin-top: 10px;
    font-weight: bold;
    font-size: 15px;
}

.footer {
    margin-top: 15px;
    font-size: 12px;
    color: #666;
}

/* ===== TABEL ===== */
.tbl-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 10px;
    border-radius: 6px;
    border: 1px solid #ddd;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th, td {
    padding: 10px 10px;
    border: 1px solid #ddd;
    text-align: left;
    font-size: 13px;
    white-space: nowrap;
}

th {
    background: #4CAF50;
    color: white;
    font-size: 13px;
}

/* ===== STATISTIK ===== */
.stat-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.stat-bar .stat-item {
    flex: 1;
    min-width: 90px;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    font-size: 13px;
}

.stat-item strong {
    display: block;
    font-size: 22px;
    color: #4CAF50;
}

/* ===== DESKTOP ===== */
@media (min-width: 620px) {
    body {
        padding-top: 56px;
        padding-bottom: 0;
    }
    .container {
        padding: 24px;
        margin-top: 20px;
    }
    h2 {
        font-size: 22px;
    }
    th, td {
        font-size: 14px;
    }
    .bottom-nav {
        display: none;
    }
}

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: white;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid #ddd;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #888;
    font-size: 10px;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.2s;
    min-width: 60px;
}

.bottom-nav a .icon {
    font-size: 22px;
    margin-bottom: 2px;
}

.bottom-nav a.active,
.bottom-nav a:hover {
    color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

.bottom-nav a.active .icon {
    transform: scale(1.1);
}

/* Space for bottom nav on mobile */
body.has-bottom-nav {
    padding-bottom: 70px;
}

/* ===== PRINT (cetak kupon) ===== */
@media print {
    body {
        background: white;
        padding: 0;
    }
    .container, .kupon {
        box-shadow: none;
        border-radius: 0;
    }
    .navbar, .bottom-nav, button, .nav-links, a.nav-btn, hr + *, .no-print {
        display: none !important;
    }
}