/* =============================================
   AlerjanApp — Modern Mobile-First UI
   ============================================= */

:root {
    --primary:        #16C784;
    --primary-dark:   #0EA86E;
    --primary-light:  #E8FAF3;
    --danger:         #FF4757;
    --danger-light:   #FFF0F1;
    --warning:        #FFA502;
    --warning-light:  #FFF8EC;
    --surface:        #FFFFFF;
    --bg:             #F2F4F7;
    --text:           #1A1F2E;
    --text-muted:     #6B7280;
    --border:         #E5E7EB;
    --shadow-sm:      0 2px 8px rgba(0,0,0,.06);
    --shadow-md:      0 4px 20px rgba(0,0,0,.10);
    --shadow-lg:      0 8px 40px rgba(0,0,0,.14);
    --radius:         16px;
    --radius-sm:      10px;
    --nav-h:          64px;
    --bottom-nav-h:   72px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding-bottom: var(--bottom-nav-h);
    min-height: 100vh;
}

/* ── Top Navbar ─────────────────────────────── */
.app-navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-h);
    background: linear-gradient(135deg, #0EA86E 0%, #16C784 100%);
    display: flex;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 2px 16px rgba(14,168,110,.3);
}

.app-logo-icon {
    display: flex;
    align-items: center;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.2));
}

.app-navbar .brand {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -.3px;
}

.app-navbar .nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-navbar .user-chip {
    background: rgba(255,255,255,.2);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(4px);
}

.app-navbar .admin-badge {
    background: #FFA502;
    color: #fff;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.app-navbar .logout-btn {
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    padding: 8px;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    font-size: 18px;
    transition: background .2s;
}
.app-navbar .logout-btn:hover { background: rgba(255,255,255,.25); }

/* ── Bottom Navigation ───────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-h);
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0,0,0,.08);
    padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    padding: 8px 0;
    border-radius: 12px;
    transition: all .2s;
    position: relative;
}

.bottom-nav a i { font-size: 22px; }

.bottom-nav a.active {
    color: var(--primary);
}

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

/* Scan butonu ortada büyük */
.bottom-nav .scan-btn {
    flex: 1.2;
}

.bottom-nav .scan-btn .scan-icon-wrap {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #0EA86E, #16C784);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    box-shadow: 0 4px 16px rgba(22,199,132,.45);
    transition: transform .2s, box-shadow .2s;
    margin-bottom: 2px;
}

.bottom-nav .scan-btn:hover .scan-icon-wrap,
.bottom-nav .scan-btn.active .scan-icon-wrap {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(22,199,132,.55);
}

/* ── Page Container ──────────────────────────── */
.page-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px 16px;
}

/* ── Page Header ─────────────────────────────── */
.page-header {
    margin-bottom: 24px;
}

.page-header h4 {
    font-size: 22px;
    font-weight: 800;
    margin: 0;
    color: var(--text);
}

.page-header p {
    font-size: 14px;
    color: var(--text-muted);
    margin: 4px 0 0;
}

/* ── Cards ───────────────────────────────────── */
.app-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}

.app-card + .app-card { margin-top: 12px; }

/* ── Alert Banners ───────────────────────────── */
.alert-banner {
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
}

.alert-banner.success { background: var(--primary-light); color: var(--primary-dark); }
.alert-banner.danger  { background: var(--danger-light);  color: var(--danger); }

/* ── Buttons ─────────────────────────────────── */
.btn-primary-app {
    background: linear-gradient(135deg, #0EA86E, #16C784);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(22,199,132,.35);
    transition: transform .15s, box-shadow .15s;
    text-decoration: none;
}
.btn-primary-app:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(22,199,132,.45); color:#fff; }
.btn-primary-app:active { transform: translateY(0); }

.btn-danger-app {
    background: linear-gradient(135deg, #FF4757, #FF6B81);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 14px rgba(255,71,87,.3);
    transition: transform .15s;
    text-decoration: none;
}
.btn-danger-app:hover { transform: translateY(-1px); color:#fff; }

.btn-ghost {
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    transition: background .15s;
}
.btn-ghost:hover { background: var(--border); color: var(--text); }

/* ── Form Controls ───────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label-app {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 8px;
    display: block;
}

.form-control-app {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.form-control-app:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22,199,132,.15);
}

.form-select-app {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

/* ── Scan Page ───────────────────────────────── */
.scan-hero {
    background: linear-gradient(160deg, #0EA86E 0%, #16C784 50%, #1ED99A 100%);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
    color: #fff;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}

.scan-hero::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 160px; height: 160px;
    background: rgba(255,255,255,.1);
    border-radius: 50%;
}

.scan-hero::after {
    content: '';
    position: absolute;
    bottom: -60px; left: -30px;
    width: 200px; height: 200px;
    background: rgba(255,255,255,.07);
    border-radius: 50%;
}

.scan-hero h2 { font-size: 24px; font-weight: 800; margin: 0 0 6px; }
.scan-hero p  { font-size: 14px; opacity: .85; margin: 0; }

.barcode-input-wrap {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    position: relative;
    z-index: 1;
}

.barcode-input-wrap input {
    flex: 1;
    padding: 14px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    outline: none;
    color: var(--text);
    background: rgba(255,255,255,.95);
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.barcode-input-wrap button {
    background: rgba(255,255,255,.2);
    border: 2px solid rgba(255,255,255,.5);
    color: #fff;
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    font-size: 18px;
    cursor: pointer;
    transition: background .2s;
    backdrop-filter: blur(4px);
}
.barcode-input-wrap button:hover { background: rgba(255,255,255,.3); }

.camera-btn {
    width: 100%;
    background: rgba(255,255,255,.15);
    border: 2px dashed rgba(255,255,255,.5);
    color: #fff;
    border-radius: var(--radius-sm);
    padding: 14px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    transition: background .2s;
    backdrop-filter: blur(4px);
    position: relative;
    z-index: 1;
}
.camera-btn:hover { background: rgba(255,255,255,.25); }

.camera-section {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom: 12px;
}

.camera-header {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 14px;
}

/* ── Scan Result ─────────────────────────────── */
.result-safe {
    background: linear-gradient(160deg, #0EA86E, #16C784);
    border-radius: var(--radius);
    padding: 40px 24px;
    text-align: center;
    color: #fff;
}

.result-danger {
    background: linear-gradient(160deg, #FF4757, #FF6B81);
    border-radius: var(--radius);
    padding: 40px 24px;
    text-align: center;
    color: #fff;
}

.result-icon {
    font-size: 64px;
    display: block;
    margin-bottom: 12px;
    animation: popIn .4s cubic-bezier(.175,.885,.32,1.275);
}

@keyframes popIn {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.result-title   { font-size: 28px; font-weight: 800; margin: 0 0 6px; }
.result-product { font-size: 16px; opacity: .9; margin: 0; }

.warning-list {
    list-style: none;
    padding: 0;
    margin: 20px 0 0;
    text-align: left;
}

.warning-item {
    background: rgba(255,255,255,.15);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    backdrop-filter: blur(4px);
}

.severity-badge {
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.severity-şiddetli { background: rgba(255,255,255,.3); color: #fff; }
.severity-orta     { background: rgba(255,255,255,.2); color: #fff; }
.severity-hafif    { background: rgba(255,255,255,.15); color: rgba(255,255,255,.9); }

/* ── History List ────────────────────────────── */
.history-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: background .15s;
}
.history-item:last-child { border-bottom: none; }
.history-item:hover { background: var(--bg); }

.history-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.history-icon.safe   { background: var(--primary-light); color: var(--primary); }
.history-icon.danger { background: var(--danger-light);  color: var(--danger); }

.history-name   { font-weight: 700; font-size: 14px; margin: 0; }
.history-meta   { font-size: 12px; color: var(--text-muted); margin: 2px 0 0; }
.history-date   { font-size: 11px; color: var(--text-muted); margin-left: auto; text-align: right; flex-shrink: 0; }

/* ── Allergen Chips ──────────────────────────── */
.allergen-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--warning-light);
    color: #92400E;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 700;
    margin: 3px;
}

.allergen-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.allergen-item:last-child { border-bottom: none; }

.severity-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}
.dot-şiddetli { background: var(--danger); }
.dot-orta     { background: var(--warning); }
.dot-hafif    { background: var(--primary); }

/* ── Auth Cards ──────────────────────────────── */
.auth-wrap {
    min-height: 100vh;
    background: linear-gradient(160deg, #0EA86E 0%, #16C784 40%, #F2F4F7 40%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    background: var(--surface);
    border-radius: 24px;
    padding: 32px 28px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    text-align: center;
    margin-bottom: 24px;
    color: var(--primary);
    font-size: 48px;
}

.auth-title {
    font-size: 24px;
    font-weight: 800;
    text-align: center;
    margin: 0 0 6px;
}

.auth-sub {
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
    margin: 0 0 28px;
}

/* ── Admin Grid ─────────────────────────────── */
@media (min-width: 720px) {
    .admin-grid {
        grid-template-columns: 1fr 340px !important;
    }
}

.admin-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── Admin Table ─────────────────────────────── */
.admin-table {
    width: 100%;
    border-collapse: collapse;
}
.admin-table th {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border);
    text-align: left;
}
.admin-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--bg); }

/* ── Divider ─────────────────────────────────── */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    color: var(--text-muted);
    font-size: 13px;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Empty State ─────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
}
.empty-state i   { font-size: 56px; opacity: .4; display: block; margin-bottom: 16px; }
.empty-state h5  { font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty-state p   { font-size: 14px; margin-bottom: 20px; }

/* ── Checkbox Grid ───────────────────────────── */
.allergen-check-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.allergen-check-item {
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    cursor: pointer;
    transition: all .15s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
}
.allergen-check-item input[type=checkbox] { accent-color: var(--primary); width: 16px; height: 16px; }
.allergen-check-item:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* ── Utilities ───────────────────────────────── */
.text-primary-app { color: var(--primary) !important; }
.text-danger-app  { color: var(--danger)  !important; }
.gap-2 { gap: 8px; }
.mt-12 { margin-top: 12px; }
.mb-16 { margin-bottom: 16px; }
