:root {
    --primary: #10B981; /* Emerald 500 */
    --primary-hover: #059669;
    --danger: #EF4444; /* Red 500 */
    --danger-hover: #DC2626;
    --background: #F3F4F6;
    --card-bg: #FFFFFF;
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.5;
    padding-bottom: 2rem;
}

/* Network Status Banner */
.status-banner {
    width: 100%;
    padding: 10px 15px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    color: white;
    position: sticky;
    top: 0;
    z-index: 50;
    transition: background-color 0.3s ease;
}
.status-banner.online {
    background-color: var(--primary);
}
.status-banner.offline {
    background-color: var(--danger);
}
.status-banner.pending {
    background-color: #F59E0B; /* amber-500 */
}

/* Header */
.app-header {
    background-color: var(--card-bg);
    padding: 20px;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.app-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}
.btn-sync {
    background-color: #EFF6FF;
    color: #3B82F6;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-sync:hover {
    background-color: #DBEAFE;
}
.btn-sync:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.sync-status-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 5px;
}
.spin {
    animation: spin 1s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* Main Layout */
.app-main {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 15px;
    box-shadow: var(--shadow);
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}
.form-group:last-child {
    margin-bottom: 0;
}
label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-main);
}
.custom-select, .custom-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background-color: #F9FAFB;
    color: var(--text-main);
    transition: border-color 0.2s;
}
.custom-select:focus, .custom-input:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #FFF;
}
.custom-select:disabled {
    opacity: 0.6;
    background-color: #E5E7EB;
}
.error-border {
    border-color: var(--danger) !important;
}

/* Stores List */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.section-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
}
.btn-primary-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}
.btn-primary-outline:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.stores-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.store-item {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.store-item .s-kode { font-size: 0.75rem; color: var(--primary); font-weight: 700; }
.store-item .s-nama { font-weight: 700; font-size: 1rem; }
.store-item .s-alamat { font-size: 0.85rem; color: var(--text-muted); }
.store-item .btn-action {
    margin-top: 8px;
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 8px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}
.empty-state {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
    background-color: #F9FAFB;
    border-radius: 8px;
    border: 1px dashed var(--border);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.modal.show {
    display: flex;
    opacity: 1;
}
.modal-content {
    background: white;
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
.bottom-sheet .modal-content {
    margin-top: auto;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    width: 100%;
    max-width: 100%;
}
.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 { font-size: 1.1rem; }
.btn-close {
    background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-muted);
}
.modal-body {
    padding: 20px;
    overflow-y: auto;
}

/* Search Stores */
.search-results-list {
    margin-top: 10px;
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.search-item {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}
.search-item:hover { background-color: #F9FAFB; }

/* Absen Sheet */
.store-info-card {
    background: #F9FAFB;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}
.store-code { color: var(--primary); font-weight: 700; font-size: 0.85rem; }
.store-name { font-size: 1.25rem; font-weight: 700; margin: 4px 0; }
.store-address { font-size: 0.85rem; color: var(--text-muted); }

.btn-large {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}
.btn-primary { background: #3B82F6; color: white; }
.btn-success { background: var(--primary); color: white; }
.btn-success.disabled { background: #9CA3AF; cursor: not-allowed; }

.hidden { display: none !important; }
.mt-3 { margin-top: 15px; }

.distance-info {
    text-align: center;
    margin: 15px 0;
    font-size: 1.1rem;
}
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 10px;
    color: white;
}
.badge.bg-success { background: var(--primary); }
.badge.bg-danger { background: var(--danger); }

.status-box {
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: 700;
    color: white;
    margin-bottom: 15px;
}

.messaging {
    padding: 10px;
    border-radius: 6px;
    color: white;
    font-size: 0.85rem;
    text-align: center;
    font-weight: 600;
}
.msg-success { background: var(--primary); }
.msg-error { background: var(--danger); }

/* Loading Spinner */
.loading-spinner {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 10px 0;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.85rem;
    z-index: 1000;
    transition: opacity 0.3s;
}
