/* ============================================
   BERES APP - Mobile First CSS
   ============================================ */

:root {
    --primary: #2468f2;
    --primary-dark: #1a4fc9;
    --primary-light: #e8f0ff;
    --secondary: #6c757d;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --light: #f8f9fa;
    --dark: #2c323f;
    --text: #2c323f;
    --text-light: #6c757d;
    --border: #e4e8f0;
    --bg: #f5f7fb;
    --white: #ffffff;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.04);
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: all 0.25s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    padding-bottom: 80px;
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 16px 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.topbar-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.location-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.2);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    max-width: 60%;
}

.location-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    position: relative;
    font-size: 16px;
}

.icon-btn .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    font-weight: 600;
}

.avatar-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255,255,255,0.2);
}

.avatar-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
}

.btn-login-topbar {
    background: white;
    color: var(--primary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.search-bar {
    background: white;
    border-radius: var(--radius);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-sm);
}

.search-bar i {
    color: var(--text-light);
}

.search-bar input {
    border: none;
    outline: none;
    flex: 1;
    font-size: 14px;
    background: transparent;
}

/* ============================================
   BOTTOM NAVIGATION
   ============================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
    z-index: 100;
    border-top: 1px solid var(--border);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    color: var(--text-light);
    font-size: 10px;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-item i {
    font-size: 20px;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 3px 3px;
}

/* ============================================
   CONTAINER & SECTION
   ============================================ */
.container {
    padding: 16px;
    max-width: 100%;
}

.section {
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 0 4px;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--dark);
}

.view-all {
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
}

/* ============================================
   CATEGORY GRID (Home)
   ============================================ */
.category-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    padding: 4px 0;
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 8px 4px;
    border-radius: var(--radius);
    transition: var(--transition);
}

.category-item:active {
    background: var(--primary-light);
    transform: scale(0.95);
}

.category-icon {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--primary-light), white);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: var(--shadow-sm);
}

.category-name {
    font-size: 11px;
    text-align: center;
    color: var(--text);
    font-weight: 500;
    line-height: 1.2;
}

/* ============================================
   BANNER / PROMO
   ============================================ */
.banner-slider {
    margin: 0 -16px 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    display: flex;
    gap: 12px;
    padding: 0 16px;
}

.banner-slider::-webkit-scrollbar {
    display: none;
}

.banner-item {
    flex: 0 0 85%;
    scroll-snap-align: start;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-lg);
    padding: 20px;
    color: white;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.banner-item::after {
    content: '';
    position: absolute;
    right: -30px;
    bottom: -30px;
    width: 120px;
    height: 120px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}

.banner-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.banner-desc {
    font-size: 12px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.banner-btn {
    align-self: flex-start;
    background: white;
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* ============================================
   SERVICE CARD
   ============================================ */
.service-card {
    background: white;
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.service-card:active {
    transform: scale(0.98);
}

.service-image {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    flex-shrink: 0;
    overflow: hidden;
}

.service-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.service-info {
    flex: 1;
    min-width: 0;
}

.service-provider {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.service-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--dark);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.service-rating {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--warning);
    margin-bottom: 6px;
}

.service-price {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.price {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
}

.price-old {
    font-size: 12px;
    color: var(--text-light);
    text-decoration: line-through;
}

.service-meta {
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.service-meta i {
    margin-right: 3px;
}

.service-desc {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.btn-add {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-add:active {
    transform: scale(0.95);
    background: var(--primary-dark);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius);
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    text-align: center;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-secondary {
    background: var(--light);
    color: var(--text);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 15px;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    background: white;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(36,104,242,0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236c757d' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

/* ============================================
   AUTH PAGE
   ============================================ */
.auth-page {
    min-height: 100vh;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--primary-light) 0%, var(--bg) 30%);
}

.auth-logo {
    text-align: center;
    margin: 30px 0 40px;
}

.auth-logo h1 {
    font-size: 36px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 4px;
    letter-spacing: -1px;
}

.auth-logo p {
    font-size: 13px;
    color: var(--text-light);
}

.auth-card {
    background: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-light);
}

.auth-footer a {
    color: var(--primary);
    font-weight: 600;
}

/* ============================================
   ALERT / TOAST
   ============================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
}

#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 90%;
}

.toast {
    background: var(--dark);
    color: white;
    padding: 12px 18px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    animation: slideDown 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); color: var(--dark); }

@keyframes slideDown {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
}

.modal-close {
    background: var(--light);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-light);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* ============================================
   CITY LIST ITEM
   ============================================ */
.city-item {
    padding: 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
}

.city-item:active {
    background: var(--primary-light);
}

.city-item i {
    color: var(--primary);
    font-size: 16px;
}

.city-item.selected {
    background: var(--primary-light);
    font-weight: 600;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-state i {
    font-size: 48px;
    opacity: 0.3;
    margin-bottom: 12px;
}

.empty-state h3 {
    font-size: 16px;
    margin-bottom: 6px;
    color: var(--dark);
}

.empty-state p {
    font-size: 13px;
}

/* ============================================
   LOADING
   ============================================ */
.loading {
    display: flex;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   UTILITIES
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-light); }
.fw-bold { font-weight: 700; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* ============================================
   RESPONSIVE (Max width 480px for mobile feel)
   ============================================ */
@media (min-width: 481px) {
    body {
        max-width: 480px;
        margin: 0 auto;
        box-shadow: 0 0 40px rgba(0,0,0,0.1);
        min-height: 100vh;
        position: relative;
    }
    
    .bottom-nav {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .modal-content {
        max-width: 480px;
    }
    
    #toast-container {
        max-width: 400px;
    }
}

.location-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.2);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    max-width: 70%;
}

.location-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
    font-weight: 500;
}