/* ==========================================================================
   UVAM Platform - Master CSS (Mobile Friendly)
   ========================================================================== */

/* --- VARIABILE & TEME --- */
:root {
    /* Tema Întunecată (Default) - Portal, Admin, Register, Legal */
    --bg: #0f172a;
    --card-bg: #1e293b;
    --primary: #38bdf8;
    --accent: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text: #f8fafc;
    --muted: #94a3b8;
    --border: #334155;
}

body.theme-light {
    /* Tema Luminoasă - Interfața client (index.php) */
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --primary: #2563eb;
    --accent: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
}

/* --- RESET & TIPOGRAFIE --- */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 20px;
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4 {
    color: var(--primary);
    margin-top: 0;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    text-decoration: underline;
}

/* --- CONTAINERE STRUCTURALE --- */
.container {
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}
.container-xl { max-width: 1100px; } /* magazine.php */
.container-lg { max-width: 1050px; } /* admin.php */
.container-md { max-width: 780px; } /* index.php */
.container-legal { max-width: 800px; } /* termeni, cookie, disclaimer */

/* Container special de centrare pentru Login / Register */
.container-auth {
    max-width: 400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 40px);
}

/* --- COMPONENTE BAZĂ --- */
.card, .box {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    width: 100%;
}

/* --- GRID-URI RESPONSIVE --- */
.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.grid-2 {
    display: grid;
    /* Auto-fit cu min 250px permite trecerea la 1 coloană automat pe telefoane */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.grid-contact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

/* --- FORMULARE & INPUT-URI --- */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 5px;
}

input[type="text"], input[type="number"], input[type="email"], input[type="password"], input[type="file"], select, textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* --- BUTOANE --- */
button {
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    border: none;
}

button:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary);
    color: #0f172a;
    font-weight: bold;
    padding: 10px 16px;
    border-radius: 6px;
}

.btn-accent {
    background: var(--accent);
    color: white;
    padding: 14px 20px;
    border-radius: 8px;
    font-weight: bold;
    width: 100%;
    font-size: 1.1rem;
}

.btn-delete {
    background: var(--danger);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.btn-logout {
    background: var(--danger);
    color: white;
    padding: 10px 15px;
    border-radius: 6px;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
}

/* --- ALERTE & STATUSURI --- */
.alert {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: bold;
    text-align: center;
    font-size: 0.9rem;
}
.alert-success, .success { background: var(--accent); color: white; }
.alert-danger, .error { background: var(--danger); color: white; }

.status-badge { padding: 4px 8px; border-radius: 12px; font-size: 0.75rem; font-weight: bold; display: inline-block; }
.status-asteptare { background: #fef08a; color: #854d0e; }
.status-lucru { background: #bfdbfe; color: #1e40af; }
.status-finalizat { background: #bbf7d0; color: #166534; }

/* --- TABELE (MOBILE FRIENDLY) --- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-top: 15px;
    min-width: 600px; /* Forțează scroll-ul orizontal pe mobile */
}

th, td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

th { background: var(--bg); color: var(--primary); }
select.status-select { background: var(--bg); color: var(--text); border: 1px solid var(--border); padding: 4px; border-radius: 4px; font-weight: bold; }

/* --- MODALE --- */
.modal-bg {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15,23,42,0.85);
    backdrop-filter: blur(4px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 20px; /* Padding for mobile */
}

.modal-card {
    background: var(--card-bg);
    border: 2px solid var(--danger);
    border-radius: 12px;
    padding: 25px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.5);
    max-height: 90vh;
    overflow-y: auto;
}

/* --- AUTOCOMPLETE NOMINATIM --- */
.autocomplete-container { position: relative; }
.autocomplete-box {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    z-index: 100;
    display: none;
    max-height: 200px;
    overflow-y: auto;
    border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}
/* Suprascrie stilurile inline din JS */
.autocomplete-box div {
    padding: 10px !important;
    border-bottom: 1px solid var(--border) !important;
    color: var(--text) !important;
    background: var(--card-bg) !important;
}
.autocomplete-box div:hover {
    background: var(--border) !important;
}

/* --- SECȚIUNE MAGAZINE PROMOVATE (magazine.php) --- */
.banner-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center; /* Centrează cardurile pe mijlocul paginii */
    gap: 15px;
}
.banner-card {
    position: relative; 
    border-radius: 10px; 
    overflow: hidden;
    border: 1px solid var(--warning); 
    background: #0f172a;
    transition: all 0.3s ease; 
    text-decoration: none; 
    color: white;
    display: flex; 
    flex-direction: column; 
    justify-content: space-between;
    min-height: 150px; 
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.1);
    
    /* Previne întinderea pe tot ecranul, păstrând o lățime fixă și responsivă */
    width: 240px; 
    max-width: 100%;
}


.banner-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(245, 158, 11, 0.35); border-color: #fbbf24; }
.banner-img-container { width: 100%; height: 100px; overflow: hidden; background: #334155; }
.banner-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.banner-placeholder { width: 100%; height: 100%; background: linear-gradient(135deg, #1e293b 0%, #334155 100%); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.85rem; font-style: italic; }
.banner-info { padding: 10px; background: rgba(15, 23, 42, 0.95); display: flex; align-items: center; gap: 10px; border-top: 1px solid #334155; }
.banner-logo, .banner-logo-placeholder { width: 35px; height: 35px; border-radius: 50%; object-fit: cover; border: 1px solid var(--warning); background: #1e293b; display: flex; align-items: center; justify-content: center; font-weight: bold; color: #0f172a; }
.banner-logo-placeholder { background: var(--warning); }

.shops-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.shop-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 20px; text-align: center; text-decoration: none; color: var(--text); transition: all 0.2s; display: flex; flex-direction: column; align-items: center; gap: 12px; position: relative; }
.shop-card:hover { border-color: var(--primary); transform: translateY(-3px); }
.shop-logo { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); background: #0f172a; }
.shop-logo-placeholder { width: 80px; height: 80px; border-radius: 50%; background: #334155; color: var(--primary); font-weight: bold; display: flex; align-items: center; justify-content: center; font-size: 2rem; border: 2px solid var(--border); }
.badge-promovat { position: absolute; top: 10px; right: 10px; background: var(--warning); color: #0f172a; font-size: 0.65rem; font-weight: bold; padding: 3px 6px; border-radius: 4px; }
.promo-section { background: #131c2e; padding: 25px; border-radius: 12px; border: 1px solid var(--warning); }
.promo-title { font-size: 1.3rem; font-weight: bold; color: var(--warning); margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }

/* --- SPECIFICE INDEX.PHP --- */
.tabs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 25px; }
.tab-btn { flex: 1; min-width: 150px; padding: 15px; text-align: center; border: 2px solid var(--border); border-radius: 8px; font-weight: bold; cursor: pointer; color: var(--muted); background: var(--bg); transition: 0.2s; }
.tab-btn.active { border-color: var(--primary); color: var(--primary); background: #eff6ff; }
.result-box { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 20px; margin: 20px 0; text-align: center; }
.price-total { font-size: 2.2rem; font-weight: 800; color: var(--primary); }
.price-unit { font-size: 1rem; color: var(--muted); margin-top: 5px; }
.box-grafica { background: #f1f5f9; padding: 15px; border-radius: 8px; border: 1px dashed #cbd5e1; margin-bottom: 15px;}
.img-preview-thumb { width: 45px; height: 45px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); cursor: pointer; }
.dpi-warning-box { background: #fff3cd; border: 1px solid #ffeba2; color: #856404; padding: 15px; border-radius: 8px; margin-top: 10px; display: none; }
.shop-tag { background: #e0f2fe; color: #0369a1; padding: 3px 6px; border-radius: 4px; font-weight: bold; font-size: 0.75rem; display: inline-block; }

/* --- SPECIFICE ADMIN.PHP --- */
.group-box { padding: 15px; border: 1px dashed var(--border); border-radius: 8px; margin-bottom: 15px;} 
.group-title { font-size: 0.85rem; color: var(--text); font-weight: bold; margin-bottom: 10px; display: block;}
.preview-box { background: var(--bg); border: 2px dashed var(--warning); border-radius: 10px; padding: 20px; margin-top: 15px; }
.live-indicator { display:inline-block; width:8px; height:8px; background:var(--accent); border-radius:50%; margin-right:5px; box-shadow: 0 0 8px var(--accent); animation: blink 2s infinite;}
@keyframes blink { 0% { opacity: 1; } 50% { opacity: 0.4; } 100% { opacity: 1; } }

/* --- FOOTER.PHP --- */
.uvam-footer { background-color: #0f172a; color: #94a3b8; font-size: 0.85rem; line-height: 1.6; border-top: 3px solid #38bdf8; margin-top: 50px; padding: 40px 20px 20px 20px; }
.uvam-footer-container { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 30px; }
.uvam-footer-col h3, .uvam-footer-col h4 { color: #f8fafc; font-size: 1rem; margin-top: 0; margin-bottom: 15px; font-weight: 700; }
.uvam-footer-links { list-style: none; padding: 0; margin: 0; }
.uvam-footer-links li { margin-bottom: 8px; }
.uvam-footer-links a { color: #cbd5e1; text-decoration: none; }
.uvam-footer-links a:hover { color: #38bdf8; }
.uvam-disclaimer-box { background: #1e293b; border: 1px solid #334155; border-radius: 8px; padding: 15px; font-size: 0.78rem; margin-bottom: 20px; color: #94a3b8; }
.uvam-anpc-badges { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 15px; }
.uvam-anpc-btn { display: inline-flex; align-items: center; background-color: #1e293b; border: 1px solid #475569; color: #ffffff; padding: 8px 12px; border-radius: 6px; font-size: 0.75rem; font-weight: 600; }
.uvam-footer-bottom { max-width: 1100px; margin: 30px auto 0 auto; padding-top: 20px; border-top: 1px solid #1e293b; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; }
.uvam-seo-keywords { font-size: 0.72rem; color: #475569; margin-top: 15px; text-align: justify; }

/* ==========================================================================
   MOBILE MEDIA QUERIES (Smartphone & Tablete mici)
   ========================================================================== */
@media (max-width: 768px) {
    body { padding: 10px; }
    .card, .box { padding: 20px; }
    
    .header-flex { flex-direction: column; align-items: flex-start; }
    .header-flex > div { width: 100%; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
    .header-flex a.btn-logout, .header-flex a.btn-register { width: 100%; text-align: center; margin-top: 5px; }

    .price-total { font-size: 1.8rem; }
    .uvam-footer { padding: 30px 15px 15px 15px; }
    .modal-card { padding: 20px; width: 95%; }

    /* Ajustare flex tab-uri pt telefon */
    .tabs { flex-direction: column; }
    .tab-btn { width: 100%; }
}