/* ============================================================
   DESKTOP LAYOUT
   Sidebar fixed left, main content scrollable right
   ============================================================ */

:root {
    --sidebar-width:        195px;
    --topbar-height:        64px;
}

/* ── App shell ──────────────────────────────────────────────── */

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

/* ── Sidebar ────────────────────────────────────────────────── */

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--clr-sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    overflow: hidden;
    transition: width .2s cubic-bezier(.4,0,.2,1);
}

.sidebar-logo {
    flex-shrink: 0;
    padding: 1.5rem 1.25rem 1rem;
    border-bottom: 1px solid var(--clr-sidebar-border);
    margin-bottom: .5rem;
    transition: padding .2s cubic-bezier(.4,0,.2,1);
}

.sidebar-logo .brand-line {
    display: flex;
    align-items: center;
    gap: .55rem;
}

.sidebar-logo .brand-line .brand-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
}

.sidebar-logo .logo-mark {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.02em;
    line-height: 1;
    display: inline-block;
    white-space: nowrap;
}

.sidebar-logo .logo-sub {
    font-size: .6875rem;
    color: var(--clr-sidebar-text);
    text-transform: uppercase;
    letter-spacing: .1em;
    margin-top: .375rem;
    display: block;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    padding: .5rem .75rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Scrollbar subtil în sidebar nav */
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }

.sidebar-footer {
    flex-shrink: 0;
    padding: 1rem .75rem;
    border-top: 1px solid var(--clr-sidebar-border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .625rem .75rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition), padding var(--transition);
}
.sidebar-user:hover { background: var(--clr-sidebar-hover); }

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
    font-size: .875rem;
    font-weight: 600;
    color: var(--clr-sidebar-active);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-role {
    font-size: .75rem;
    color: var(--clr-sidebar-text);
    text-transform: capitalize;
}

/* ── Main content ───────────────────────────────────────────── */

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left .2s cubic-bezier(.4,0,.2,1);
}

/* ── Top bar (desktop — hidden; only visible on mobile) ─────── */

.topbar { display: none; }

/* ── Sidebar Quickbar ───────────────────────────────────────── */

.sidebar-quickbar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: .5rem .5rem .75rem;
}

.sq-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    color: var(--clr-sidebar-text);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    position: relative;
    flex-shrink: 0;
}
.sq-btn:hover {
    background: var(--clr-sidebar-hover);
    color: var(--clr-sidebar-active);
}

/* Badge în sidebar — border-color trebuie să se potrivească cu bg-ul dark al sidebar-ului */
.sidebar-quickbar .topbar-badge {
    border-color: var(--clr-sidebar-bg);
}

/* Notification dropdown din sidebar: position fixed ca să iasă din overflow:hidden */
.notif-wrap--sidebar {
    position: static;
}
.notif-dropdown--sidebar {
    position: fixed;
    left: calc(var(--sidebar-width) + 8px);
    bottom: 1rem;
    top: auto;
    right: auto;
    width: 340px;
}

/* Topbar actions (nu mai există pe desktop, dar păstrăm pentru compatibilitate) */
.topbar-actions { display: none; }

.topbar-icon-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--clr-border);
    background: var(--clr-surface);
    color: var(--clr-text-muted);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}
.topbar-icon-btn:hover {
    background: var(--clr-surface-2);
    color: var(--clr-text);
}

.topbar-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--clr-danger);
    color: #fff;
    font-size: .625rem;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--clr-surface);
}

/* ── Page content area ──────────────────────────────────────── */

.page-content {
    padding: 2rem;
    flex: 1;
    min-width: 0;
}

.page-header {
    margin-bottom: 1.75rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--clr-text);
    line-height: 1.2;
}

.page-subtitle {
    font-size: .9375rem;
    color: var(--clr-text-muted);
    margin-top: .25rem;
}

/* ── Grid layouts ───────────────────────────────────────────── */

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

.grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.25rem;
}

.grid-6 {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.grid-main-side {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.5rem;
    align-items: start;
}

/* ── Tables ─────────────────────────────────────────────────── */

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--clr-border);
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

table.data-table thead tr {
    background: var(--clr-thead-bg);
    border-bottom: 2px solid var(--clr-border);
}

table.data-table th {
    padding: .75rem 1rem;
    text-align: left;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--clr-text);
    white-space: nowrap;
}

table.data-table td {
    padding: .875rem 1rem;
    color: var(--clr-text);
    border-bottom: 1px solid var(--clr-border);
    vertical-align: middle;
}

table.data-table tbody tr:last-child td { border-bottom: none; }

table.data-table tbody tr:hover { background: var(--clr-surface-2); }

/* ── Tasks list: every row matches the header height (45px). A row only grows
      taller when it carries an extra line (notes preview / est. hours). Long
      task names stay on one line with an ellipsis instead of wrapping. ── */
table.tasks-table td {
    height: 45px;
    padding-top: .3rem;
    padding-bottom: .3rem;
}
table.tasks-table td[data-col="name"] > div { min-width: 0; }
table.tasks-table td[data-col="name"] .tb-task-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Auth page (login) ──────────────────────────────────────── */

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--clr-sidebar-bg);
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--clr-surface);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo-mark {
    font-size: 2rem;
    font-weight: 800;
    color: var(--clr-text);
    letter-spacing: -.04em;
}

.auth-logo-mark span { color: var(--clr-primary); }

.auth-logo-sub {
    font-size: .75rem;
    color: var(--clr-text-muted);
    text-transform: uppercase;
    letter-spacing: .12em;
    margin-top: .25rem;
}

.auth-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--clr-text);
    margin-bottom: .25rem;
}

.auth-subtitle {
    font-size: .9rem;
    color: var(--clr-text-muted);
    margin-bottom: 1.75rem;
}

.auth-form { display: flex; flex-direction: column; gap: 1.125rem; }

.auth-submit {
    width: 100%;
    padding: .875rem;
    justify-content: center;
    font-size: 1rem;
    margin-top: .25rem;
}

/* ── Products — dropdown positioning ───────────────────────── */

.prod-dd-wrap { position: relative; }

.prod-dd {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 300;
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    min-width: 160px;
    max-height: 340px;
    overflow-y: auto;
}

.prod-dd-title {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--clr-text-muted);
    padding: .5rem .75rem .25rem;
}

.prod-dd-item {
    display: flex;
    align-items: center;
    padding: .45rem .75rem;
    cursor: pointer;
    color: var(--clr-text);
    font-size: .875rem;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
}
.prod-dd-item:hover { background: var(--clr-surface-2); }

.prod-dd-sep  { height: 1px; background: var(--clr-border); margin: .25rem 0; }
.prod-dd-danger { color: var(--clr-danger) !important; }

.prod-dd-radio {
    width: 10px; height: 10px;
    border-radius: 50%;
    border: 2px solid var(--clr-border);
    display: inline-block;
    flex-shrink: 0;
    margin-right: .5rem;
}
.prod-dd-radio.active { background: var(--clr-primary); border-color: var(--clr-primary); }

.prod-icon-btn {
    width: 22px; height: 22px;
    border-radius: var(--radius-sm);
    border: none;
    background: none;
    color: var(--clr-text-muted);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition);
    text-decoration: none;
    flex-shrink: 0;
}
.prod-icon-btn:hover { background: var(--clr-surface-2); color: var(--clr-text); }
.prod-icon-btn.watched svg { fill: #f59e0b; stroke: #f59e0b; }

.row-copy-btn {
    opacity: 1;
    width: 22px; height: 22px;
    border-radius: var(--radius-sm);
    border: none; background: none;
    color: var(--clr-text-muted);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0; flex-shrink: 0;
    transition: all var(--transition);
}
.row-copy-btn:hover { background: var(--clr-surface-2); color: var(--clr-text); }

/* ── Products — sticky columns ──────────────────────────────── */

/* Freeze coloane CHK + ASIN via CSS sticky nativ. border-collapse:collapse
   e cunoscut instabil cu sticky (Chrome/Safari pot sari bordurile la
   scroll), de-asta #prod-table trece pe separate + spacing 0 — nu are
   celule cu borduri pe muchii comune, deci vizual e identic. transform:
   translateZ(0) forteaza propriul layer de compositing pentru celula
   sticky, ca sa evitam bug-ul Chrome de ordine de pictare a fundalului
   celulelor de tabel (care altfel ignora z-index). */
#prod-table {
    border-collapse: separate;
    border-spacing: 0;
}
/* border-collapse:separate nu randeaza bordura pusa pe <tr> (doar pe celule),
   asa ca mutam bottom-border-ul header-ului direct pe th, doar pt acest tabel */
#prod-table thead th {
    border-bottom: 2px solid var(--clr-border);
}

th.col-chk, td.col-chk {
    position: sticky;
    left: 0;
    z-index: 4;
    width: 47px;
    min-width: 47px;
    max-width: 47px;
    background: var(--clr-surface);
    transform: translateZ(0);
}
thead th.col-chk { background: var(--clr-thead-bg); }
tbody tr:hover td.col-chk { background: var(--clr-surface-2); }

/* left trebuie sa fie exact latimea reala a coloanei col-chk (47px, nu 32px
   cat sugera width-ul inline din markup) — altfel coloana ASIN se suprapune
   peste cea cu checkbox la scroll si acopera bordura dintre ele */
th.col-asin, td.col-asin {
    position: sticky;
    left: 47px;
    z-index: 4;
    background: var(--clr-surface);
    min-width: 230px;
    border-right: 2px solid var(--clr-border);
    box-shadow: 4px 0 10px -2px rgba(0,0,0,.10);
    transform: translateZ(0);
}
thead th.col-asin { background: var(--clr-thead-bg); }
tbody tr:hover td.col-asin { background: var(--clr-surface-2); }

/* Spatiu intre coloana ASIN (freeze) si urmatoarea coloana */
#prod-table th.col-asin + th,
#prod-table td.col-asin + td {
    padding-left: 1.75rem;
}

/* ── Products — thumbnail ───────────────────────────────────── */

.prod-thumb-wrap { display: inline-block; flex-shrink: 0; }

.prod-thumb {
    width: 44px; height: 44px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid var(--clr-border);
    background: #fff;
    display: block;
    cursor: zoom-in;
}

#prod-img-zoom {
    display: none;
    position: fixed;
    z-index: 9999;
    width: 200px; height: 200px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--clr-border);
    background: #fff;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
    pointer-events: none;
}
