/* =====================================================================
   Boustras Farm — Admin panel styles
   Παλέτα: πράσινο / λευκό / γκρι. Καθαρό, μοντέρνο, responsive.
   ===================================================================== */

:root {
    /* Βαθύ, σκούρο "forest" πράσινο (λιγότερο λαχανί) */
    --green-900: #0e3a20;
    --green-800: #134a29;
    --green-700: #15663a;
    --green-600: #178045;
    --green-500: #1f9a52;
    --green-200: #c3e6cc;
    --green-100: #d6ebdc;
    --green-50:  #eef6f0;

    --gray-900: #1f2937;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-500: #6b7280;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --gray-50:  #f9fafb;

    --white: #ffffff;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --warning: #b45309;
    --warning-bg: #fef3c7;
    --info: #1d4ed8;
    --info-bg: #dbeafe;

    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08);
    --sidebar-w: 248px;

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font);
    color: var(--gray-900);
    background: var(--gray-100);
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--green-700); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- Shell */
.app-shell { display: flex; min-height: 100vh; }

/* ---------------------------------------------------------------- Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: var(--green-900);
    color: #e8f5e9;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 40;
    transition: transform .25s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 18px;
    font-size: 18px; font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.brand-mark { font-size: 22px; }
.sidebar-nav { display: flex; flex-direction: column; padding: 12px 10px; gap: 2px; overflow-y: auto; }
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px;
    color: #d7ead9;
    border-radius: 8px;
    font-size: 14.5px;
    transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--green-600); color: #fff; font-weight: 600; }
.nav-icon { width: 22px; text-align: center; }
.nav-logout { margin-top: 10px; border-top: 1px solid rgba(255,255,255,.1); border-radius: 0; padding-top: 16px; }
.nav-logout:hover { color: #fecaca; }

/* ---------------------------------------------------------------- Main */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 14px 26px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 20;
}
.page-title { font-size: 20px; margin: 0; color: var(--gray-900); }
.topbar-right { display: flex; align-items: center; gap: 18px; color: var(--gray-600); font-size: 14px; }
.topbar-season strong { color: var(--green-700); }

.content { padding: 24px 26px; flex: 1; }
.app-footer {
    padding: 16px 26px; color: var(--gray-500); font-size: 13px;
    border-top: 1px solid var(--gray-200); background: var(--white);
}

/* ---------------------------------------------------------------- Toggle (mobile) */
.sidebar-toggle {
    display: none;
    position: fixed; top: 12px; left: 12px; z-index: 60;
    background: var(--green-700); color: #fff; border: none;
    width: 42px; height: 42px; border-radius: 8px; font-size: 20px; cursor: pointer;
}
.sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35;
}

/* ---------------------------------------------------------------- Cards */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
    border: 1px solid var(--gray-200);
}
.stat-card .stat-label { color: var(--gray-500); font-size: 13px; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .03em; }
.stat-card .stat-value { font-size: 24px; font-weight: 700; color: var(--gray-900); }
.stat-card.green  .stat-value { color: var(--green-700); }
.stat-card.red    .stat-value { color: var(--danger); }
.stat-card .stat-icon { float: right; font-size: 26px; opacity: .5; }

.panel {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 22px;
    overflow: hidden;
}
.panel-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--gray-200);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    flex-wrap: wrap;
}
.panel-head h2, .panel-head h3 { margin: 0; font-size: 16px; }
.panel-body { padding: 18px; }
.panel-body.no-pad { padding: 0; }

/* ---------------------------------------------------------------- Tables */
.table-wrap { overflow-x: auto; }
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
table.data th, table.data td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}
table.data thead th {
    background: var(--gray-50);
    color: var(--gray-600);
    font-weight: 600;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: .02em;
}
table.data tbody tr:hover { background: var(--green-50); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .muted { color: var(--gray-400); }
.table-empty { padding: 28px; text-align: center; color: var(--gray-500); }

tr.total-row td { font-weight: 700; background: var(--green-50); border-top: 2px solid var(--green-200, #bbf7d0); }

/* ---------------------------------------------------------------- Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s, opacity .15s;
    text-decoration: none;
    line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--green-600); color: #fff; }
.btn-primary:hover { background: var(--green-700); color: #fff; }
.btn-secondary { background: var(--white); color: var(--gray-700); border-color: var(--gray-300); }
.btn-secondary:hover { background: var(--gray-50); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: none; color: var(--green-700); padding: 4px 6px; cursor: pointer; font-size: 13px; }

.actions-cell { display: flex; gap: 6px; }

/* ---------------------------------------------------------------- Forms */
form label { display: block; margin-bottom: 14px; font-size: 14px; color: var(--gray-700); font-weight: 500; }
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=search], input[type=tel], select, textarea {
    width: 100%;
    padding: 9px 11px;
    margin-top: 5px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--white);
    color: var(--gray-900);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px var(--green-100);
}
textarea { resize: vertical; min-height: 64px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 18px; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }
.help { color: var(--gray-500); font-size: 12.5px; font-weight: 400; }

/* Filters bar */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters label { margin-bottom: 0; }
.filters .btn { margin-bottom: 0; }

/* ---------------------------------------------------------------- Alerts */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; border: 1px solid transparent; }
.alert-success { background: var(--green-100); color: var(--green-900); border-color: var(--green-500); }
.alert-error   { background: var(--danger-bg); color: #7f1d1d; border-color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: #78350f; border-color: #f59e0b; }
.alert-info    { background: var(--info-bg); color: #1e3a8a; border-color: var(--info); }

/* ---------------------------------------------------------------- Badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-green { background: var(--green-100); color: var(--green-900); }
.badge-gray  { background: var(--gray-200); color: var(--gray-700); }
.badge-red   { background: var(--danger-bg); color: #7f1d1d; }
.badge-a { background: var(--green-600); color: #fff; }
.badge-b { background: var(--gray-400); color: #fff; }

.amount-pos { color: var(--green-700); font-weight: 600; }
.amount-neg { color: var(--danger); font-weight: 600; }
.muted { color: var(--gray-500); }
.text-right { text-align: right; }

/* ---------------------------------------------------------------- Auth pages */
.auth-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--green-700), var(--green-900));
    padding: 20px;
}
.auth-card {
    background: var(--white);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    padding: 32px 30px;
    width: 100%; max-width: 380px;
}
.auth-brand { text-align: center; font-size: 22px; font-weight: 700; color: var(--green-800, #166534); margin-bottom: 6px; }
.auth-title { text-align: center; margin-top: 0; color: var(--gray-700); font-size: 18px; }

/* Two-column layout helper */
.layout-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }

/* Lists in dashboard */
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--gray-100); font-size: 14px; }
.mini-list li:last-child { border-bottom: none; }
.mini-list .ml-main { color: var(--gray-800, #1f2937); }
.mini-list .ml-sub { color: var(--gray-500); font-size: 12.5px; }

code { background: var(--gray-100); padding: 2px 6px; border-radius: 5px; font-size: 13px; }

/* ---------------------------------------------------------------- Icons */
.icon { width: 1.15em; height: 1.15em; display: inline-block; vertical-align: -0.18em; flex: 0 0 auto; }
.nav-icon { display: inline-flex; align-items: center; }
.nav-icon .icon { width: 19px; height: 19px; vertical-align: middle; }
.btn .icon { width: 1.05em; height: 1.05em; vertical-align: -0.16em; }
.panel-head h2 .icon, .panel-head h3 .icon { width: 1.1em; height: 1.1em; vertical-align: -0.2em; color: var(--green-600); }
.stat-card .stat-icon .icon { width: 26px; height: 26px; }
.topbar-user .icon { width: 18px; height: 18px; vertical-align: -0.22em; color: var(--gray-500); }
.auth-brand .icon { width: 26px; height: 26px; vertical-align: -0.35em; color: var(--green-600); }
.brand-mark { display: inline-flex; }
.brand-mark .icon { width: 22px; height: 22px; }
.alert .icon { width: 1.05em; height: 1.05em; vertical-align: -0.16em; }
.sidebar-toggle .icon { width: 22px; height: 22px; }

/* ---------------------------------------------------------------- Theme toggle */
.theme-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 8px;
    background: var(--white); border: 1px solid var(--gray-300);
    color: var(--gray-600); cursor: pointer; padding: 0; transition: background .15s, color .15s;
}
.theme-toggle:hover { background: var(--gray-50); color: var(--green-600); }
.theme-toggle .icon { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: inline-block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: inline-block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---------------------------------------------------------------- Dark mode */
:root { color-scheme: light; }
[data-theme="dark"] {
    color-scheme: dark;
    --white:    #1e242c;   /* επιφάνειες (cards, topbar, inputs) */
    --gray-50:  #242c36;
    --gray-100: #12161c;   /* φόντο σελίδας */
    --gray-200: #2c3540;   /* περιγράμματα */
    --gray-300: #3a4552;
    --gray-400: #5c6775;
    --gray-500: #8a97a6;
    --gray-600: #aab6c4;
    --gray-700: #c9d3dd;
    --gray-900: #eef2f7;   /* κύριο κείμενο */

    --green-50:  #16271c;  /* table hover / total-row bg */
    --green-100: #1b3325;
    --green-200: #2c5238;

    --danger:    #ef4444;
    --danger-bg: #371d1d;
    --warning:   #fbbf24;
    --warning-bg:#352c12;
    --info:      #60a5fa;
    --info-bg:   #14253b;

    --shadow:    0 1px 3px rgba(0,0,0,.5), 0 1px 2px rgba(0,0,0,.4);
    --shadow-md: 0 8px 26px rgba(0,0,0,.6);
}
/* Στοιχεία που χρησιμοποιούν το βαθύ πράσινο ως ΚΕΙΜΕΝΟ χρειάζονται φωτεινό tint στο dark */
[data-theme="dark"] a { color: #4fbf7e; }
[data-theme="dark"] .topbar-season strong { color: #4fbf7e; }
[data-theme="dark"] .amount-pos { color: #43c578; }
[data-theme="dark"] .stat-card.green .stat-value { color: #43c578; }
[data-theme="dark"] .alert-success { background: #15301f; color: #9fe7b5; border-color: #1f6f3f; }
[data-theme="dark"] .alert-error   { background: #371d1d; color: #f4b4b4; border-color: #a33b3b; }
[data-theme="dark"] .alert-warning { background: #352c12; color: #f3d38a; border-color: #9a7a1f; }
[data-theme="dark"] .alert-info    { background: #14253b; color: #aac8f2; border-color: #2f5da8; }
[data-theme="dark"] .badge-green   { background: #1c3a28; color: #8fe0aa; }
[data-theme="dark"] .badge-a       { background: var(--green-600); color: #fff; }
[data-theme="dark"] .panel-head h2 .icon, [data-theme="dark"] .panel-head h3 .icon { color: #43c578; }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { background: #161c23; }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 900px) {
    .layout-2col { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .sidebar-toggle { display: block; }
    .sidebar.open ~ .sidebar-overlay { display: block; }
    .topbar { padding-left: 64px; }
    .topbar-right { gap: 10px; font-size: 12.5px; }
    .content { padding: 16px; }
}
