@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap');

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

:root {
    --tq:     #2EC4B6;
    --tq-d:   #25a99d;
    --tq-glow:rgba(46,196,182,.35);
    --anth:   #1E1E1E;
    --anth3:  #2a2a2a;
    --bg:     #F7FAFC;
    --white:  #FFFFFF;
    --text:   #1A1A1A;
    --muted:  #6B6B6B;
    --border: #E2E8F0;
    --sb:     220px;
    --bn:     62px;
}

body {
    font-family:'Poppins', sans-serif;
    background:var(--anth);
    background-image:
        repeating-linear-gradient( 60deg,transparent,transparent 44px,var(--anth3) 44px,var(--anth3) 45px),
        repeating-linear-gradient(-60deg,transparent,transparent 44px,var(--anth3) 44px,var(--anth3) 45px);
    color:var(--text);
    font-size:15px; font-weight:300;
    min-height:100vh;
}

/* ══════════════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════════════ */
.sidebar {
    width:var(--sb); position:fixed; top:0; left:0; bottom:0;
    background:rgba(14,14,14,.75);
    border-right:1px solid rgba(255,255,255,.06);
    display:flex; flex-direction:column;
    z-index:200;
}
.sidebar-logo {
    font-size:21px; font-weight:600; color:#fff;
    letter-spacing:1px; padding:28px 24px 12px; flex-shrink:0;
}
.sidebar-logo span { color:var(--tq); }
.sidebar-sep {
    width:32px; height:2px; background:var(--tq);
    border-radius:2px; margin:0 24px 18px;
}
.sidebar-nav {
    flex:1; padding:4px 10px;
    display:flex; flex-direction:column; gap:2px;
    overflow-y:auto;
}
.sidebar-link {
    display:flex; align-items:center; gap:10px;
    color:rgba(255,255,255,.7); text-decoration:none;
    font-size:14px; padding:10px 14px;
    border-radius:10px; transition:all .2s; white-space:nowrap;
}
.sidebar-link:hover  { background:rgba(255,255,255,.08); color:#fff; }
.sidebar-link.active { background:rgba(46,196,182,.14); color:var(--tq); font-weight:400; }
.sidebar-icon { font-size:16px; }
.sidebar-footer {
    padding:14px 10px;
    border-top:1px solid rgba(255,255,255,.06);
}

.btn-logout {
    display:block; width:100%; text-align:center;
    background:transparent; border:1px solid rgba(255,255,255,.2);
    color:rgba(255,255,255,.6); padding:8px 16px; border-radius:20px;
    font-family:inherit; font-size:13px; cursor:pointer;
    text-decoration:none; transition:all .2s;
}
.btn-logout:hover { border-color:var(--tq); color:var(--tq); }

/* ── Layout wrapper ── */
.layout { margin-left:var(--sb); min-height:100dvh; }

/* ══════════════════════════════════════════════════════════
   FLASH BAR
══════════════════════════════════════════════════════════ */
.flash-bar    { padding:11px 24px; font-size:14px; text-align:center; }
.flash-success{ background:rgba(46,196,182,.15); color:#9AE6B4; }
.flash-error  { background:rgba(252,129,129,.15); color:#FEB2B2; }

/* ══════════════════════════════════════════════════════════
   TIMER PAGE  (index.php — vertically centred card)
══════════════════════════════════════════════════════════ */
.timer-page {
    min-height:calc(100dvh - var(--bn));
    display:flex; align-items:center; justify-content:center;
    padding:28px 20px calc(var(--bn) + 28px);
}

.timer-card {
    background:var(--white); border-radius:22px;
    padding:34px 30px 28px; width:100%; max-width:420px;
    box-shadow:0 32px 80px rgba(0,0,0,.55);
}
.timer-card-logo {
    text-align:center; font-size:26px; font-weight:600;
    color:var(--text); margin-bottom:8px;
}
.timer-card-logo span { color:var(--tq); }
.timer-card-sep {
    width:36px; height:2px; background:var(--tq);
    border-radius:2px; margin:0 auto 24px;
}
.timer-no-client { text-align:center; color:var(--muted); font-size:14px; line-height:2; }
.timer-no-client a { color:var(--tq); text-decoration:none; }
.to-invoice-pill {
    display:block; text-align:center; margin-top:18px;
    background:rgba(46,196,182,.1); color:var(--tq);
    font-size:12px; padding:8px 16px; border-radius:20px;
    text-decoration:none; transition:background .2s;
}
.to-invoice-pill:hover { background:rgba(46,196,182,.18); }

/* Active timer in card */
@keyframes fadeUp { from{opacity:0;transform:translateY(16px)} to{opacity:1;transform:translateY(0)} }

.ta-status-badge {
    display:inline-block; font-size:10px; text-transform:uppercase;
    letter-spacing:1.5px; padding:4px 14px; border-radius:20px;
}
.ta-status-running { background:rgba(46,196,182,.12); color:var(--tq); }
.ta-status-paused  { background:rgba(252,129,129,.12); color:#FC8181;
                     animation:blink 1.4s ease-in-out infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.25} }

.ta-client { font-size:22px; font-weight:500; color:var(--text); margin-bottom:4px; line-height:1.2; }
.ta-note   { font-size:14px; color:var(--muted); }

.ta-timer {
    font-size:64px; font-weight:300; color:var(--tq);
    font-variant-numeric:tabular-nums; letter-spacing:1px;
    line-height:1; margin:18px 0 22px;
    animation:timerPulse 2.5s ease-in-out infinite;
}
@keyframes timerPulse { 0%,100%{opacity:1} 50%{opacity:.55} }
.ta-timer-paused { opacity:.3 !important; animation:none !important; }

.ta-btn-row { display:flex; gap:10px; width:100%; }
.ta-btn-row form     { flex:1; display:flex; }
.ta-btn-row .btn-big { flex:1; max-width:none; }
.ta-stop-form { width:100%; display:flex; flex-direction:column; gap:14px; }

/* Email toggle (white card variant) */
.email-toggle {
    display:flex; align-items:center; gap:10px; cursor:pointer;
    color:var(--muted); font-size:13px; user-select:none;
}
.email-toggle em { color:var(--text); font-style:normal; }
.email-cb { display:none; }
.email-toggle-track {
    width:38px; height:22px; border-radius:11px;
    background:var(--bg); border:1px solid var(--border);
    position:relative; flex-shrink:0; transition:background .2s,border-color .2s;
}
.email-toggle-track::after {
    content:''; position:absolute; top:3px; left:3px;
    width:14px; height:14px; border-radius:50%;
    background:var(--border); transition:transform .2s,background .2s;
}
.email-cb:checked + .email-toggle-track { background:var(--tq); border-color:var(--tq); }
.email-cb:checked + .email-toggle-track::after { transform:translateX(16px); background:#fff; }

/* ══════════════════════════════════════════════════════════
   BIG BUTTONS
══════════════════════════════════════════════════════════ */
.btn-big {
    width:100%; max-width:320px; border:none;
    padding:15px 24px; border-radius:14px;
    font-family:inherit; font-size:16px; font-weight:500;
    cursor:pointer; transition:all .2s;
    min-height:52px; letter-spacing:.5px;
}
.btn-big-start { background:var(--tq); color:#fff; }
.btn-big-start:hover { background:var(--tq-d); transform:translateY(-1px); box-shadow:0 8px 24px var(--tq-glow); }
.btn-big-stop  { background:#FC8181; color:#fff; }
.btn-big-stop:hover  { background:#F56565; transform:translateY(-1px); }
.btn-big-pause { background:var(--bg); color:var(--muted); border:1px solid var(--border); }
.btn-big-pause:hover { background:var(--border); color:var(--text); transform:translateY(-1px); }

/* ══════════════════════════════════════════════════════════
   CONTAINER
══════════════════════════════════════════════════════════ */
.container {
    max-width:1100px; margin:28px auto;
    padding:0 24px calc(var(--bn) + 20px);
}

/* ══════════════════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════════════════ */
.card { background:var(--white); border-radius:12px; padding:22px; border:1px solid var(--border); }
.card-title {
    font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:1.2px;
    color:var(--tq); margin-bottom:16px; padding-bottom:10px; border-bottom:1px solid var(--border);
}
.card-hint { text-align:center; color:var(--muted); font-size:14px; padding:20px 0; line-height:1.8; }

/* ══════════════════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════════════════ */
.form-group { margin-bottom:14px; }
.form-group label { display:block; font-size:13px; font-weight:400; color:var(--muted); margin-bottom:6px; }
.opt { color:var(--border); font-size:12px; }

.form-control {
    width:100%; padding:11px 14px;
    border:1px solid var(--border); border-radius:8px;
    font-family:inherit; font-size:15px; color:var(--text);
    background:var(--bg); outline:none;
    transition:border-color .2s;
    min-height:46px; -webkit-appearance:none; appearance:none;
}
.form-control:focus { border-color:var(--tq); background:var(--white); }

select.form-control {
    cursor:pointer;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B6B6B' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat:no-repeat; background-position:right 14px center; padding-right:36px;
}

.form-row-2 { display:grid; grid-template-columns:1fr 1fr; gap:12px; }

.btn-primary {
    width:100%; background:var(--tq); color:#fff; border:none;
    padding:12px 24px; border-radius:24px; font-family:inherit;
    font-size:14px; font-weight:500; cursor:pointer;
    transition:background .2s; margin-top:6px; min-height:46px;
}
.btn-primary:hover { background:var(--tq-d); }

/* ══════════════════════════════════════════════════════════
   CLIENTS LIST
══════════════════════════════════════════════════════════ */
.client-list { list-style:none; }
.client-item { border-bottom:1px solid var(--border); }
.client-item:last-child { border-bottom:none; }
.client-row  { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 0; }
.client-info { flex:1; min-width:0; }
.client-name { display:block; font-size:15px; font-weight:400; color:var(--text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.client-meta { display:flex; flex-wrap:wrap; gap:6px 14px; margin-top:3px; }
.client-meta-link { font-size:13px; color:var(--tq); text-decoration:none; }
.client-meta-link:hover { text-decoration:underline; }
.client-nb   { font-size:12px; color:var(--muted); }
.client-actions { display:flex; gap:6px; align-items:center; flex-shrink:0; }

.btn-edit { background:transparent; border:1px solid var(--border); color:var(--muted);
            width:34px; height:34px; border-radius:8px; font-size:14px; cursor:pointer;
            transition:all .2s; display:flex; align-items:center; justify-content:center; }
.btn-edit:hover, .client-item.editing .btn-edit { background:var(--tq); border-color:var(--tq); color:#fff; }

.btn-delete { background:transparent; border:1px solid #FEB2B2; color:#FC8181;
              width:34px; height:34px; border-radius:8px; font-size:12px; cursor:pointer;
              transition:all .2s; display:flex; align-items:center; justify-content:center; }
.btn-delete:hover { background:#FED7D7; border-color:#FC8181; }

.btn-stats  { color:var(--tq); text-decoration:none; font-size:14px; padding:0 6px;
              display:flex; align-items:center; height:34px; }

.client-edit-panel { max-height:0; overflow:hidden; transition:max-height .3s ease,padding .3s ease; }
.client-edit-panel.open { max-height:400px; padding-bottom:16px; }
.edit-form    { background:var(--bg); border-radius:10px; padding:16px; }
.edit-actions { display:flex; gap:10px; margin-top:4px; }

.btn-save   { flex:1; background:var(--tq); color:#fff; border:none; padding:10px; border-radius:8px;
              font-family:inherit; font-size:14px; font-weight:500; cursor:pointer;
              transition:background .2s; min-height:42px; }
.btn-save:hover { background:var(--tq-d); }
.btn-cancel { flex:1; background:transparent; border:1px solid var(--border); color:var(--muted);
              padding:10px; border-radius:8px; font-family:inherit; font-size:14px;
              cursor:pointer; transition:all .2s; min-height:42px; }
.btn-cancel:hover { border-color:var(--muted); color:var(--text); }

/* ══════════════════════════════════════════════════════════
   STATS / HISTORY
══════════════════════════════════════════════════════════ */
.filter-bar {
    background:var(--white); border:1px solid var(--border); border-radius:12px;
    padding:16px 20px; margin-bottom:20px;
    display:flex; gap:12px; align-items:flex-end; flex-wrap:wrap;
}
.filter-bar .form-group { margin:0; flex:1; min-width:110px; }

.btn-filter {
    background:var(--tq); color:#fff; border:none;
    padding:11px 20px; border-radius:8px; font-family:inherit;
    font-size:14px; font-weight:500; cursor:pointer;
    transition:background .2s; min-height:46px; white-space:nowrap; align-self:flex-end;
}
.btn-filter:hover { background:var(--tq-d); }

.stats-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:20px; }
.stat-card  { background:var(--white); border:1px solid var(--border); border-radius:12px; padding:18px; }
.stat-card.accent { border-top:3px solid var(--tq); }
.stat-value { font-size:22px; font-weight:500; color:var(--text); font-variant-numeric:tabular-nums; }
.stat-value.turquoise { color:var(--tq); }
.stat-label { font-size:11px; text-transform:uppercase; letter-spacing:.8px; color:var(--muted); margin-top:4px; }

.history-card   { background:var(--white); border-radius:12px; border:1px solid var(--border); overflow:hidden; margin-bottom:20px; }
.history-header { padding:15px 20px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
.history-header .card-title { margin:0; padding:0; border:none; }

.table-wrap { overflow-x:auto; -webkit-overflow-scrolling:touch; }
table { width:100%; border-collapse:collapse; }
thead th { padding:10px 14px; text-align:left; font-size:11px; font-weight:600;
           text-transform:uppercase; letter-spacing:.8px; color:var(--muted);
           border-bottom:1px solid var(--border); background:var(--bg); white-space:nowrap; }
tbody td { padding:12px 14px; font-size:14px; border-bottom:1px solid var(--border); vertical-align:middle; }
tbody tr:last-child td { border-bottom:none; }
tbody tr:hover { background:#f8fbfc; }
tfoot td { padding:11px 14px; font-size:14px; font-weight:500; background:var(--bg); border-top:2px solid var(--border); }

.duration { font-variant-numeric:tabular-nums; white-space:nowrap; }
.badge         { display:inline-block; padding:3px 10px; border-radius:12px; font-size:12px; font-weight:500; white-space:nowrap; }
.badge-success { background:#C6F6D5; color:#276749; }
.badge-warning { background:#FEFCBF; color:#744210; }

.btn-invoice,
.btn-email {
    background:transparent; border:1px solid var(--tq); color:var(--tq);
    padding:5px 13px; border-radius:16px; font-family:inherit;
    font-size:12px; cursor:pointer; transition:all .2s; white-space:nowrap;
}
.btn-invoice:hover,
.btn-email:hover { background:var(--tq); color:#fff; }

.badge-email-sent {
    display:inline-block; padding:3px 10px; border-radius:12px;
    font-size:12px; font-weight:500; white-space:nowrap;
    background:#C6F6D5; color:#276749;
}

.btn-row-edit {
    background:transparent; border:1px solid var(--border); color:var(--muted);
    padding:4px 11px; border-radius:8px; font-size:13px;
    cursor:pointer; transition:all .2s; white-space:nowrap;
}
.btn-row-edit:hover { border-color:var(--tq); color:var(--tq); }

.empty-state { text-align:center; padding:40px 20px; color:var(--muted); font-size:14px; }
.dash { color:var(--border); }

/* ══════════════════════════════════════════════════════════
   MODALS
══════════════════════════════════════════════════════════ */
.modal-overlay {
    display:none; position:fixed; inset:0; z-index:500;
    background:rgba(0,0,0,.6); backdrop-filter:blur(3px);
    align-items:center; justify-content:center; padding:20px;
}
.modal-overlay.open { display:flex; }

.modal-box {
    background:var(--white); border-radius:16px;
    width:100%; max-width:560px; max-height:90dvh;
    overflow-y:auto; box-shadow:0 24px 64px rgba(0,0,0,.4);
    padding:28px 28px 24px;
    animation:fadeUp .25s ease both;
}
.modal-title {
    font-size:16px; font-weight:500; color:var(--text);
    padding-bottom:14px; margin-bottom:18px;
    border-bottom:1px solid var(--border);
}
.modal-textarea {
    font-family:'Courier New',monospace !important;
    font-size:13px !important; line-height:1.6;
    resize:vertical; min-height:220px;
}
.modal-actions { display:flex; gap:10px; margin-top:6px; }

.btn-danger-full {
    width:100%; margin-top:10px; background:transparent;
    border:1px solid #FEB2B2; color:#FC8181;
    padding:10px; border-radius:8px; font-family:inherit;
    font-size:13px; cursor:pointer; transition:all .2s; min-height:42px;
}
.btn-danger-full:hover { background:#FED7D7; border-color:#F56565; color:#C53030; }

/* ══════════════════════════════════════════════════════════
   BOTTOM NAV  (mobile only)
══════════════════════════════════════════════════════════ */
.bottom-nav {
    display:none; position:fixed; bottom:0; left:0; right:0;
    height:var(--bn); background:var(--anth); border-top:1px solid var(--anth3);
    z-index:200; padding-bottom:env(safe-area-inset-bottom,0px);
}
.bn-item { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center;
           gap:3px; color:var(--muted); text-decoration:none; font-size:11px;
           letter-spacing:.3px; transition:color .2s; padding-top:8px; }
.bn-item.active { color:var(--tq); }
.bn-icon { font-size:22px; line-height:1; }

/* ══════════════════════════════════════════════════════════
   LOGIN  (standalone, no sidebar)
══════════════════════════════════════════════════════════ */
.login-page {
    min-height:100vh; display:flex; align-items:center;
    justify-content:center; padding:24px;
}
.login-card { background:var(--white); border-radius:16px; padding:40px 36px;
              width:100%; max-width:380px; box-shadow:0 24px 64px rgba(0,0,0,.45); }
.login-logo  { text-align:center; font-size:30px; font-weight:600; color:var(--text); margin-bottom:10px; }
.login-logo span { color:var(--tq); }
.login-separator { height:2px; width:40px; background:var(--tq); border-radius:2px; margin:0 auto 10px; }
.login-sub   { text-align:center; color:var(--muted); font-size:14px; margin-bottom:28px; }
.alert       { padding:11px 16px; border-radius:8px; font-size:14px; margin-bottom:16px; }
.alert-error { background:#FED7D7; color:#9B2C2C; border:1px solid #FEB2B2; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */
@media (max-width:768px) {
    .sidebar    { display:none; }
    .layout     { margin-left:0; }
    .bottom-nav { display:flex; }

    .container  { padding:0 14px calc(var(--bn) + 16px); margin:16px auto; }
    .timer-page { padding-bottom:calc(var(--bn) + 24px); }

    .ta-timer   { font-size:54px; letter-spacing:1px; }
    .ta-client  { font-size:20px; }
    .btn-big    { max-width:100%; }

    .form-row-2 { grid-template-columns:1fr; }
    .stats-grid { grid-template-columns:1fr 1fr; }
    .filter-bar { flex-direction:column; gap:10px; }
    .filter-bar .form-group { min-width:unset; width:100%; }

    thead th, tbody td { padding:10px 10px; }
}

@media (max-width:400px) {
    .ta-timer   { font-size:46px; }
    .timer-card { padding:26px 20px 22px; }
}
