/* ==========================================================================
   CC Pontaj - Capital Clean
   Tema pe CSS variables (injectate din themes.palette_json in header.php).
   Mobile-first, Montserrat, branding #32CDCA.
   ========================================================================== */

:root {
    --primary: #32CDCA;
    --primary-dark: #1FA8A5;
    --accent: #0B7C7A;
    --surface: #ffffff;
    --surface-alt: #f2fbfb;
    --text: #17383B;
    --muted: #6b8a8c;
    --success: #2fac66;
    --warning: #e2a53a;
    --danger: #d64550;
    --sidebar-w: 250px;
}

[data-theme="dark"] {
    --surface: #152322;
    --surface-alt: #0d1615;
    --text: #e8f4f3;
    --muted: #a3bdbc; /* suficient contrast pe fundal inchis */
}

html, body {
    font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
    background: var(--surface-alt);
    color: var(--text);
    font-size: 15px;
}

/* Bootstrap override cu paleta temei */
.btn-primary {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-dark);
    --bs-btn-hover-border-color: var(--primary-dark);
    --bs-btn-active-bg: var(--accent);
    --bs-btn-active-border-color: var(--accent);
}
.btn-outline-primary {
    --bs-btn-color: var(--primary-dark);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary);
    --bs-btn-hover-border-color: var(--primary);
}
a { color: var(--primary-dark); }
.text-primary { color: var(--primary-dark) !important; }
.bg-primary { background-color: var(--primary) !important; }

[data-theme="dark"] .card,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .list-group-item {
    background: var(--surface);
    color: var(--text);
}
[data-theme="dark"] .table { color: var(--text); --bs-table-bg: transparent; --bs-table-color: var(--text); }
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background: var(--surface-alt);
    color: var(--text);
    border-color: #2e4342;
}
[data-theme="dark"] .card { border-color: #263a39; }
[data-theme="dark"] .card-header { border-bottom-color: #263a39; }
[data-theme="dark"] .text-muted { color: var(--muted) !important; }

/* texte ajutatoare / tooltip-uri: contrast corect in ambele teme */
.form-text { color: var(--muted); }
[data-theme="dark"] .form-text { color: var(--muted); }
[data-theme="dark"] ::placeholder { color: #7fa09f; opacity: 1; }

/* dropdown-uri (ex: meniul de profil dreapta-sus) */
[data-theme="dark"] .dropdown-menu {
    background: #1a2b2a;
    border-color: #2e4342;
    --bs-dropdown-link-color: var(--text);
    --bs-dropdown-link-hover-color: #ffffff;
    --bs-dropdown-link-hover-bg: rgba(50, 205, 202, .14);
}
[data-theme="dark"] .dropdown-item { color: var(--text); }
[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus { color: #fff; background: rgba(50, 205, 202, .14); }
[data-theme="dark"] .dropdown-divider { border-color: #2e4342; }

/* cod inline (ex: uploads/) */
[data-theme="dark"] code { color: #6fe0dd; }

/* fundaluri "light" folosite in tabele / diff-uri audit */
[data-theme="dark"] .bg-light { background-color: #1b2d2c !important; color: var(--text); }
[data-theme="dark"] .table-light { --bs-table-bg: #1b2d2c; --bs-table-color: var(--text); color: var(--text); border-color: #2e4342; }
[data-theme="dark"] .badge.bg-light { background-color: #28403e !important; color: #d4e9e8 !important; border-color: transparent !important; }
[data-theme="dark"] .badge.bg-secondary { background-color: #3a4f4e !important; }

/* alerte lizibile pe fundal inchis */
[data-theme="dark"] .alert-info      { background: #11333a; color: #a8dfec; border-color: #1d4a54; }
[data-theme="dark"] .alert-warning   { background: #3a2e10; color: #ffd97a; border-color: #5c4a1a; }
[data-theme="dark"] .alert-danger    { background: #3a171b; color: #ffa2aa; border-color: #5c242b; }
[data-theme="dark"] .alert-success   { background: #123325; color: #93e5b8; border-color: #1d4f39; }
[data-theme="dark"] .alert-secondary { background: #22302f; color: #c8d9d8; border-color: #334948; }
[data-theme="dark"] .alert .alert-link { color: inherit; text-decoration: underline; }
[data-theme="dark"] .btn-close { filter: invert(1) grayscale(1) brightness(1.6); }

/* butoane outline vizibile pe dark */
[data-theme="dark"] .btn-outline-secondary { color: #c2d5d4; border-color: #405756; }
[data-theme="dark"] .btn-outline-secondary:hover { background: #2a3d3c; color: #fff; border-color: #405756; }
[data-theme="dark"] .btn-icon { border-color: #2e4342; }

/* tabele: hover si delimitari */
[data-theme="dark"] .table-hover > tbody > tr:hover > * { background: rgba(255, 255, 255, .045); color: var(--text); }
[data-theme="dark"] .table > :not(caption) > * > * { border-bottom-color: #223634; }
[data-theme="dark"] .list-group-item { border-color: #263a39; }
[data-theme="dark"] .list-group-item-action:hover { background: rgba(50, 205, 202, .1); color: var(--text); }
[data-theme="dark"] pre { color: var(--text); }

/* ==========================================================================
   Layout: shell + sidebar + topbar
   ========================================================================== */

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

.app-sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid rgba(0,0,0,.06);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    transform: translateX(-100%);
    transition: transform .2s ease;
}
.app-sidebar.is-open { transform: translateX(0); }
.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1035;
}
.sidebar-backdrop.show { display: block; }

@media (min-width: 992px) {
    .app-sidebar { position: sticky; top: 0; height: 100vh; transform: none; }
    .sidebar-backdrop { display: none !important; }
    .app-main { margin-left: 0; }
    /* hide/unhide meniu pe desktop (stare persistata in localStorage) */
    html.cc-sidebar-hidden .app-sidebar { display: none; }
}

.sidebar-brand {
    display: flex; align-items: center;
    padding: 1rem 1rem .75rem;
}
.brand-logo { max-width: 160px; height: auto; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 0 .5rem 1rem; }
.nav-section-label {
    font-size: .68rem; letter-spacing: .08em; text-transform: uppercase;
    color: var(--muted); padding: .9rem .75rem .3rem;
}
.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: .65rem;
    color: var(--text);
    border-radius: 8px;
    padding: .55rem .75rem;
    min-height: 44px;
    font-weight: 500;
    font-size: .92rem;
}
.sidebar-nav .nav-link:hover { background: var(--surface-alt); }
.sidebar-nav .nav-link.active {
    background: var(--primary);
    color: #fff;
}
.sidebar-nav .nav-link i { font-size: 1.05rem; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.app-topbar {
    display: flex; align-items: center;
    background: var(--surface);
    border-bottom: 1px solid rgba(0,0,0,.06);
    padding: .6rem 1rem;
    position: sticky; top: 0; z-index: 1020;
}
.app-topbar .btn-link { color: var(--text); }
.btn-icon {
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,.08);
    background: var(--surface);
    color: var(--text);
    font-size: 1.05rem;
}
.btn-icon:hover { background: var(--surface-alt); }

.app-content { padding: 1rem; }
@media (min-width: 992px) { .app-content { padding: 1.5rem 2rem; } }

.standalone-content { min-height: 100vh; }

/* ==========================================================================
   Card-uri, tabele responsive (rand = card pe mobil)
   ========================================================================== */

.card { border: 1px solid rgba(0,0,0,.07); border-radius: 12px; }
.card-header { background: transparent; font-weight: 600; }

.table thead th {
    font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted); font-weight: 600;
}

@media (max-width: 767.98px) {
    .table-cards thead { display: none; }
    .table-cards tbody tr {
        display: block;
        background: var(--surface);
        border: 1px solid rgba(0,0,0,.08);
        border-radius: 10px;
        margin-bottom: .7rem;
        padding: .5rem .75rem;
    }
    .table-cards tbody td {
        display: flex; justify-content: space-between; gap: 1rem;
        border: 0; padding: .3rem 0;
        text-align: right;
    }
    .table-cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--muted);
        text-align: left;
    }
    .table-cards tbody td.no-label::before { content: none; }
}

/* input font minim 16px pe mobil (iOS zoom) */
@media (max-width: 767.98px) {
    input.form-control, select.form-select, textarea.form-control { font-size: 16px; }
}

/* campurile nu se comprima sub o latime lizibila; la nevoie fac wrap pe randul urmator */
select.form-select { min-width: 130px; text-overflow: ellipsis; }
input.form-control[type="date"] { min-width: 130px; }
input.form-control[type="time"] { min-width: 92px; }

/* date / time picker: tot campul e clicabil, iconita vizibila si pe dark */
input[type="date"], input[type="time"], input[type="month"] { cursor: pointer; }
input::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .75; }
[data-theme="dark"] input::-webkit-calendar-picker-indicator { filter: invert(1) brightness(1.4); }
.row.g-2 > [class*="col-"], .row.g-3 > [class*="col-"] { min-width: 0; }

/* bara fixa jos pe mobil pentru actiuni principale */
.action-bar-mobile {
    position: sticky; bottom: 0;
    background: var(--surface);
    border-top: 1px solid rgba(0,0,0,.08);
    padding: .6rem 1rem;
    margin: 1rem -1rem -1rem;
    z-index: 1010;
}
@media (min-width: 992px) {
    .action-bar-mobile { position: static; background: transparent; border: 0; margin: 1rem 0 0; padding: 0; }
}

/* ==========================================================================
   Splash login Capital Clean
   ========================================================================== */

.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(1200px 600px at 85% -10%, rgba(50,205,202,.25), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(50,205,202,.18), transparent 55%),
        var(--surface-alt);
    padding: 1rem;
}
.login-card {
    width: 100%; max-width: 420px;
    background: var(--surface);
    border-radius: 18px;
    box-shadow: 0 18px 60px rgba(23,56,59,.14);
    padding: 2rem 1.75rem;
    animation: loginIn .5s ease both;
}
@keyframes loginIn {
    from { opacity: 0; transform: translateY(14px) scale(.98); }
    to   { opacity: 1; transform: none; }
}
.login-logo { text-align: center; margin-bottom: .5rem; }
.login-logo img { max-width: 220px; animation: logoPulse 2.4s ease-in-out infinite alternate; }
@keyframes logoPulse {
    from { filter: drop-shadow(0 0 0 rgba(50,205,202,0)); }
    to   { filter: drop-shadow(0 6px 18px rgba(50,205,202,.45)); }
}
.login-sub { text-align: center; color: var(--muted); font-size: .85rem; margin-bottom: 1.5rem; }

/* splash overlay la incarcare */
.splash-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; gap: 1rem;
    animation: splashOut .6s ease 1.2s both;
    pointer-events: none;
}
.splash-overlay .splash-logo {
    width: min(260px, 60vw);
    animation: splashMark .9s ease both;
}
@keyframes splashMark {
    from { opacity: 0; transform: scale(.6); }
    60%  { opacity: 1; transform: scale(1.08); }
    to   { transform: scale(1); }
}
@keyframes splashOut {
    to { opacity: 0; visibility: hidden; }
}

/* ==========================================================================
   Pontaj: grila lunara
   ========================================================================== */

.pontaj-table td, .pontaj-table th { vertical-align: middle; }
.pontaj-table .weekend { background: rgba(0,0,0,.035); }
[data-theme="dark"] .pontaj-table .weekend { background: rgba(255,255,255,.05); }
.pontaj-table .holiday { background: rgba(50,205,202,.12); }
.pontaj-table input[type="time"] { max-width: 110px; }
.pontaj-locked { opacity: .65; pointer-events: none; }

.overtime-badge {
    background: var(--primary);
    color: #fff; border-radius: 8px;
    padding: .15rem .55rem; font-weight: 600;
}

/* harta OSM */
.map-picker { height: 320px; border-radius: 10px; border: 1px solid rgba(0,0,0,.1); }

/* dashboard tiles */
.stat-tile {
    background: var(--surface);
    border: 1px solid rgba(0,0,0,.07);
    border-radius: 14px;
    padding: 1rem 1.2rem;
}
.stat-tile .stat-value { font-size: 1.7rem; font-weight: 700; color: var(--primary-dark); }
.stat-tile .stat-label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
