/* ============================================================
   SALAMANDRA APP - CSS V2 (multi-tenant, scroll-friendly)
   ============================================================ */

/* === CSS Variables (configurabile prin :root in app_head) === */
:root {
    --brand-color: #00b14f;
    --brand-color-dark: #008f3f;
    --brand-bg: #f5f7fa;
    --text-dark: #1a1a2e;
    --text-muted: #888;
    --border-color: #e5e7eb;
    --card-bg: #ffffff;
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 10px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
}

/* ============================================================
   RESET + BAZA
   ============================================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    /* CRITIC: scroll vertical PERMIS, horizontal blocat */
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-text-size-adjust: 100%; /* anti zoom auto pe iOS */
    -ms-text-size-adjust: 100%;
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--brand-bg);
    color: var(--text-dark);
    line-height: 1.5;
    font-size: 15px;
    
    /* SCROLL VERTICAL - permis pe toate device-urile */
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100vh;
    min-height: 100dvh;
    
    /* iOS momentum scroll */
    -webkit-overflow-scrolling: touch;
    
    /* anti zoom pe iOS la dublu tap */
    touch-action: pan-y;
}

/* PC: aplicația arată ca aplicație mobilă centrată */
@media (min-width: 768px) {
    body {
        background: linear-gradient(135deg, #e9eff5, #f5f7fa);
    }
    .app-container {
        max-width: 480px;
        margin: 0 auto;
        background: var(--brand-bg);
        min-height: 100vh;
        box-shadow: 0 0 60px rgba(0,0,0,0.08);
        position: relative;
    }
}

/* ============================================================
   TIPOGRAFIE
   ============================================================ */
h1 { font-size: 24px; font-weight: 700; color: var(--text-dark); }
h2 { font-size: 20px; font-weight: 700; color: var(--text-dark); }
h3 { font-size: 16px; font-weight: 600; color: var(--text-dark); }
p  { margin: 4px 0; }

a { color: var(--brand-color); text-decoration: none; }
a:hover { opacity: 0.85; }

/* ============================================================
   APP BAR (TOP BAR cu Home + Back)
   ============================================================ */
.app-bar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    padding-top: calc(12px + env(safe-area-inset-top));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.app-bar h1 {
    font-size: 17px;
    font-weight: 600;
    flex: 1;
    text-align: center;
    margin: 0;
    color: var(--text-dark);
}

.app-bar a, .app-bar button {
    color: var(--text-dark);
    background: transparent;
    border: none;
    padding: 8px;
    font-size: 18px;
    cursor: pointer;
    border-radius: 8px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-bar a:active {
    background: #f0f0f0;
}

.app-bar a.home-btn {
    color: var(--brand-color);
}

/* ============================================================
   BOTTOM NAV (universal pe toate paginile)
   ============================================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 6px 0;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.bottom-nav a {
    flex: 1;
    text-align: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 10px;
    padding: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-height: 50px;
    justify-content: center;
}

.bottom-nav a i {
    font-size: 19px;
}

.bottom-nav a.active {
    color: var(--brand-color);
    font-weight: 600;
}

.bottom-nav a:active {
    background: #f8f9fa;
}

/* ============================================================
   CONTAINER PAGINI
   ============================================================ */
.page-content {
    padding: 14px;
    padding-bottom: 90px; /* spatiu pentru bottom nav */
    max-width: 100%;
    overflow-x: hidden;
}

/* === LOGO === */
.logo-img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
input, select, textarea, button {
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}

input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=number], input[type=date], input[type=datetime-local],
input[type=url], select, textarea {
    padding: 11px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    font-size: 16px !important; /* CRITIC: 16px+ blocheaza zoom-ul iOS */
    background: #fff;
    color: var(--text-dark);
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

select {
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand-color);
    box-shadow: 0 0 0 3px rgba(0,177,79,0.1);
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: #555;
    font-weight: 500;
}

.form-group {
    margin-bottom: 14px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (max-width: 380px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

/* ============================================================
   BUTOANE
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--brand-color);
    color: #fff;
    border: none;
    padding: 13px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    min-height: 48px;
    width: auto;
}

.btn:active {
    transform: scale(0.97);
    background: var(--brand-color-dark);
}

.btn:disabled {
    opacity: 0.6;
    pointer-events: none;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    padding: 7px 12px;
    font-size: 12px;
    min-height: 34px;
}

.btn-secondary {
    background: #6c757d;
}
.btn-secondary:active {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
}
.btn-danger:active {
    background: #b32a37;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--card-bg);
    border-radius: 14px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.card-header {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.card-header i {
    color: var(--brand-color);
}

.card-body {
    padding: 14px 16px;
}

/* ============================================================
   ALERTE
   ============================================================ */
.alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 12px;
    font-size: 13px;
    border-left: 4px solid;
    display: flex;
    align-items: start;
    gap: 8px;
}

.alert-success { background: #d4edda; color: #155724; border-color: #28a745; }
.alert-danger  { background: #f8d7da; color: #721c24; border-color: #dc3545; }
.alert-warning { background: #fff3cd; color: #856404; border-color: #ffc107; }
.alert-info    { background: #d1ecf1; color: #0c5460; border-color: #17a2b8; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-danger  { background: #f8d7da; color: #721c24; }
.badge-warn    { background: #fff3cd; color: #856404; }
.badge-info    { background: #d1ecf1; color: #0c5460; }
.badge-grey    { background: #e9ecef; color: #495057; }

/* ============================================================
   UTILITARE
   ============================================================ */
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-small  { font-size: 11px; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.d-flex      { display: flex; }
.gap-1       { gap: 6px; }
.gap-2       { gap: 10px; }
.flex-1      { flex: 1; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ============================================================
   ANIMATII
   ============================================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* ============================================================
   FAB (floating action button)
   ============================================================ */
.fab {
    position: fixed;
    bottom: calc(80px + env(safe-area-inset-bottom));
    right: 16px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--brand-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 4px 12px rgba(0,177,79,0.4);
    text-decoration: none;
    z-index: 99;
    border: none;
    cursor: pointer;
}

.fab:active {
    transform: scale(0.93);
}

/* PC: FAB centrat in container app */
@media (min-width: 768px) {
    .fab {
        right: calc(50% - 240px + 16px);
    }
    .bottom-nav {
        bottom: 0;
    }
}

/* ============================================================
   FIX iOS - input zoom prevention (font-size: 16px) e mai sus
   ============================================================ */