/* ============================================================
   Martontej Kontroll Rendszer – Stíluslap
   Fájl: kontroll/style.css
   ============================================================ */

/* --- CSS Változók (Martontej brand) --- */
:root {
    --brown-dark:   #2C1810;
    --brown-mid:    #4A2C1A;
    --brown-light:  #6B3F25;
    --copper:       #B87333;
    --gold:         #C9A84C;
    --gold-light:   #E8C97A;
    --cream:        #F5EFE6;
    --cream-dark:   #EDE3D4;
    --white:        #FDFAF6;
    --text-dark:    #1C1008;
    --text-mid:     #4A3728;
    --text-light:   #8C7060;
    --bg:           #F0E8DC;
    --sidebar-w:    260px;
    --radius:       10px;
    --shadow:       0 2px 16px rgba(44,24,16,0.10);
    --shadow-lg:    0 8px 32px rgba(44,24,16,0.18);

    /* Státusz színek */
    --status-varakozik:   #D4920A;
    --status-jovahagyva:  #2E7D32;
    --status-elutasitva:  #C62828;
    --status-teljesitve:  #555;

    /* Prioritás */
    --prio-normal:  #2E7D32;
    --prio-sulyos:  #D4920A;
    --prio-azonnali:#C62828;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--brown-dark);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 200;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(201,168,76,0.2);
}

.logo-mark {
    width: 40px; height: 40px;
    background: var(--gold);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Cormorant Garamond', serif;
    font-size: 22px; font-weight: 700;
    color: var(--brown-dark);
    flex-shrink: 0;
}

.logo-text { display: flex; flex-direction: column; }
.logo-main { font-family: 'Cormorant Garamond', serif; font-size: 18px; font-weight: 600; color: var(--gold-light); line-height: 1.1; }
.logo-sub { font-size: 11px; font-weight: 500; color: var(--copper); letter-spacing: 1.5px; text-transform: uppercase; }

.nav-user {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.user-avatar {
    width: 34px; height: 34px;
    background: var(--copper);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Cormorant Garamond', serif;
    font-size: 16px; font-weight: 700;
    color: white; flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; overflow: hidden; }
.user-name { font-size: 13px; font-weight: 600; color: var(--cream); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--copper); }

.nav-links { list-style: none; padding: 12px 0; flex: 1; overflow-y: auto; }
.nav-links li { margin: 2px 10px; }

.nav-links a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(245,239,230,0.7);
    text-decoration: none;
    font-size: 14px; font-weight: 400;
    transition: all 0.18s;
    position: relative;
}

.nav-links a svg {
    width: 18px; height: 18px;
    stroke: currentColor; fill: none;
    stroke-width: 1.8; flex-shrink: 0;
}

.nav-links a:hover { background: rgba(201,168,76,0.1); color: var(--gold-light); }
.nav-links a.active { background: var(--gold); color: var(--brown-dark); font-weight: 600; }
.nav-links a.active svg { stroke: var(--brown-dark); }

.badge {
    margin-left: auto;
    background: #C62828;
    color: white;
    font-size: 11px; font-weight: 700;
    min-width: 20px; height: 20px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 5px;
}

.nav-footer { padding: 16px 10px; border-top: 1px solid rgba(255,255,255,0.06); }

.logout-btn {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 8px;
    color: rgba(245,239,230,0.5);
    text-decoration: none; font-size: 13px;
    transition: all 0.18s;
}
.logout-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.logout-btn:hover { color: #ff6b6b; background: rgba(198,40,40,0.1); }

/* --- Mobile topbar --- */
.mobile-topbar {
    display: none;
    position: fixed; top: 0; left: 0; right: 0; height: 56px;
    background: var(--brown-dark);
    align-items: center; gap: 12px;
    padding: 0 16px;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.hamburger {
    background: none; border: none; cursor: pointer; padding: 4px;
    color: var(--gold-light);
}
.hamburger svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; }
.mobile-title { font-family: 'Cormorant Garamond', serif; font-size: 18px; color: var(--cream); flex: 1; }
.mobile-badge {
    background: #C62828; color: white; font-size: 12px; font-weight: 700;
    width: 22px; height: 22px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
}

.overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5); z-index: 190;
}
.overlay.visible { display: block; }

/* --- Main content --- */
.main-content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    padding: 32px;
    flex: 1;
    max-width: calc(100vw - var(--sidebar-w));
}

/* --- Page header --- */
.page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 28px; gap: 16px; flex-wrap: wrap;
}

.page-header h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 32px; font-weight: 600;
    color: var(--brown-dark);
    line-height: 1.1;
}

.page-header .sub { font-size: 14px; color: var(--text-light); margin-top: 4px; }

/* --- Kártyák --- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    border: 1px solid var(--cream-dark);
}

/* --- Stat kártyák (dashboard) --- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow);
    border: 1px solid var(--cream-dark);
    border-left: 4px solid var(--copper);
    display: flex; flex-direction: column; gap: 6px;
    transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card.warning { border-left-color: var(--status-varakozik); }
.stat-card.success { border-left-color: var(--status-jovahagyva); }
.stat-card.danger  { border-left-color: var(--status-elutasitva); }
.stat-card.neutral { border-left-color: var(--text-light); }

.stat-label { font-size: 12px; font-weight: 500; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.8px; }
.stat-value { font-family: 'Cormorant Garamond', serif; font-size: 38px; font-weight: 700; color: var(--brown-dark); line-height: 1; }
.stat-sub { font-size: 12px; color: var(--text-light); }

/* --- Táblázatok --- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

table {
    width: 100%; border-collapse: collapse;
    font-size: 14px;
}

thead th {
    background: var(--cream);
    padding: 11px 14px;
    text-align: left;
    font-size: 11px; font-weight: 600;
    color: var(--text-mid);
    text-transform: uppercase; letter-spacing: 0.7px;
    border-bottom: 2px solid var(--cream-dark);
    white-space: nowrap;
}

tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--cream-dark);
    vertical-align: middle;
    color: var(--text-dark);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--cream); }

/* --- Státusz badge-ek --- */
.status-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
    white-space: nowrap;
}
.status-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.status-varakozik  { background: #FFF3CD; color: var(--status-varakozik); }
.status-jovahagyva { background: #E8F5E9; color: var(--status-jovahagyva); }
.status-elutasitva { background: #FFEBEE; color: var(--status-elutasitva); }
.status-teljesitve { background: #F5F5F5; color: var(--status-teljesitve); }

/* --- Prioritás badge --- */
.prio-badge {
    display: inline-block; padding: 2px 8px; border-radius: 4px;
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.prio-normal  { background: #E8F5E9; color: var(--prio-normal); }
.prio-sulyos  { background: #FFF3CD; color: var(--prio-sulyos); }
.prio-azonnali{ background: #FFEBEE; color: var(--prio-azonnali); }

/* --- Gombok --- */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 18px; border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px; font-weight: 500;
    border: none; cursor: pointer;
    text-decoration: none;
    transition: all 0.18s;
    white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

.btn-primary   { background: var(--brown-dark); color: var(--gold-light); }
.btn-primary:hover { background: var(--brown-mid); }

.btn-gold      { background: var(--gold); color: var(--brown-dark); font-weight: 600; }
.btn-gold:hover { background: var(--gold-light); }

.btn-success   { background: #2E7D32; color: white; }
.btn-success:hover { background: #1B5E20; }

.btn-danger    { background: #C62828; color: white; }
.btn-danger:hover { background: #B71C1C; }

.btn-outline   { background: transparent; color: var(--brown-dark); border: 1.5px solid var(--cream-dark); }
.btn-outline:hover { background: var(--cream); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* --- Formok --- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

label {
    font-size: 13px; font-weight: 500;
    color: var(--text-mid);
}

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"],
select, textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--cream-dark);
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    color: var(--text-dark);
    background: var(--white);
    transition: border-color 0.18s, box-shadow 0.18s;
    -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--copper);
    box-shadow: 0 0 0 3px rgba(184,115,51,0.15);
}

textarea { resize: vertical; min-height: 90px; }
select { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234A3728' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* Tételek táblázat (form-ban) */
.items-table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.items-table th { padding: 8px 10px; background: var(--cream); font-size: 12px; font-weight: 600; color: var(--text-mid); text-align: left; border-bottom: 2px solid var(--cream-dark); }
.items-table td { padding: 6px 4px; border-bottom: 1px solid var(--cream-dark); }
.items-table input, .items-table select { padding: 7px 9px; border-radius: 6px; }
.items-table .btn-remove { background: none; border: none; cursor: pointer; color: var(--status-elutasitva); padding: 4px 8px; font-size: 18px; line-height: 1; }
.items-table .btn-remove:hover { background: #FFEBEE; border-radius: 4px; }

/* --- Flash üzenetek --- */
.flash {
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px; font-weight: 500;
    display: flex; align-items: center; gap: 10px;
    transition: opacity 0.4s, transform 0.4s;
}
.flash-success { background: #E8F5E9; color: #2E7D32; border: 1px solid #A5D6A7; }
.flash-error   { background: #FFEBEE; color: #C62828; border: 1px solid #EF9A9A; }
.flash-info    { background: #E3F2FD; color: #1565C0; border: 1px solid #90CAF9; }

/* --- Üres állapot --- */
.empty-state {
    text-align: center; padding: 56px 24px;
    color: var(--text-light);
}
.empty-state svg { width: 48px; height: 48px; stroke: var(--cream-dark); fill: none; stroke-width: 1.5; margin-bottom: 16px; }
.empty-state p { font-size: 15px; margin-bottom: 20px; }

/* --- Szűrő sáv --- */
.filter-bar {
    display: flex; gap: 10px; flex-wrap: wrap;
    margin-bottom: 18px; align-items: flex-end;
}
.filter-bar select, .filter-bar input { max-width: 180px; }
.filter-bar .btn { align-self: flex-end; }

/* --- Megrendelés részlet oldal --- */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}
.detail-block { display: flex; flex-direction: column; gap: 12px; }
.detail-row { display: flex; flex-direction: column; gap: 2px; }
.detail-row .key { font-size: 11px; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.7px; }
.detail-row .val { font-size: 15px; color: var(--text-dark); }

/* Jóváhagyó panel */
.approval-panel {
    background: var(--cream);
    border-radius: var(--radius);
    padding: 22px 24px;
    border: 2px solid var(--gold);
    margin-top: 24px;
}
.approval-panel h3 { font-family: 'Cormorant Garamond', serif; font-size: 20px; margin-bottom: 14px; color: var(--brown-dark); }
.approval-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* --- Rendelesszam stílus --- */
.rendelesszam {
    font-family: 'Cormorant Garamond', serif;
    font-size: 15px; font-weight: 600;
    color: var(--brown-mid);
    letter-spacing: 0.5px;
}

/* --- Reszponzív --- */
@media (max-width: 899px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .mobile-topbar { display: flex; }
    .main-content { margin-left: 0; padding: 72px 16px 24px; max-width: 100vw; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .filter-bar select, .filter-bar input { max-width: 100%; }
    .page-header { flex-direction: column; }
}

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .stat-value { font-size: 30px; }
}

/* --- Back link a sidebarban --- */
.back-link {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    border-radius: 8px;
    color: rgba(245,239,230,0.4);
    transition: all 0.18s;
    flex-shrink: 0;
    margin-right: -4px;
}
.back-link svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }
.back-link:hover { background: rgba(255,255,255,0.08); color: var(--gold-light); }
