/* ===================================
   HIGHTECH PONTO — PREMIUM UI
   =================================== */

:root {
    --bg-primary: #06060f;
    --bg-secondary: #0d0d1a;
    --bg-card: rgba(18, 18, 35, 0.7);
    --bg-card-hover: rgba(25, 25, 50, 0.85);
    --bg-sidebar: rgba(10, 10, 22, 0.95);

    --text-primary: #e8e8f0;
    --text-secondary: #8888aa;
    --text-muted: #555577;

    --green: #00e676;
    --green-dim: rgba(0, 230, 118, 0.15);
    --red: #ff5252;
    --red-dim: rgba(255, 82, 82, 0.15);
    --blue: #448aff;
    --blue-dim: rgba(68, 138, 255, 0.15);
    --yellow: #ffab40;
    --yellow-dim: rgba(255, 171, 64, 0.15);
    --purple: #b388ff;
    --purple-dim: rgba(179, 136, 255, 0.15);

    --gradient-green: linear-gradient(135deg, #00e676, #00c853);
    --gradient-red: linear-gradient(135deg, #ff5252, #d50000);
    --gradient-blue: linear-gradient(135deg, #448aff, #2962ff);
    --gradient-purple: linear-gradient(135deg, #b388ff, #7c4dff);

    --border-color: rgba(255, 255, 255, 0.06);
    --border-glow: rgba(68, 138, 255, 0.3);

    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;

    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);

    --sidebar-width: 260px;
    --topbar-height: 70px;

    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== LIGHT THEME ===== */
body.light-theme {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    --bg-sidebar: rgba(255, 255, 255, 0.97);

    --text-primary: #1a1a2e;
    --text-secondary: #555577;
    --text-muted: #8888aa;

    --border-color: rgba(0, 0, 0, 0.08);
    --border-glow: rgba(68, 138, 255, 0.25);

    --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);
}

body.light-theme {
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(68, 138, 255, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(179, 136, 255, 0.04) 0%, transparent 50%);
}

body.light-theme .topbar {
    background: rgba(255, 255, 255, 0.85);
}

body.light-theme .input-date::-webkit-calendar-picker-indicator {
    filter: none;
}

body.light-theme .punch-tag {
    background: #f0f2f5;
}

body.light-theme .status-absent {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme tr:hover td {
    background: rgba(68, 138, 255, 0.06);
}

body.light-theme ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

body.light-theme ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

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

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(ellipse at 20% 50%, rgba(68, 138, 255, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(179, 136, 255, 0.03) 0%, transparent 50%);
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    backdrop-filter: blur(20px);
    transition: transform var(--transition);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 32px;
    background: var(--gradient-blue);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 8px;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-primary), var(--blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: var(--transition);
}

.sidebar-close:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: var(--gradient-blue);
    border-radius: 0 4px 4px 0;
    transform: scaleY(0);
    transition: var(--transition);
}

.nav-item:hover {
    background: rgba(68, 138, 255, 0.08);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(68, 138, 255, 0.12);
    color: var(--blue);
}

.nav-item.active::before {
    transform: scaleY(1);
}

.nav-item .material-icons-round {
    font-size: 22px;
}

.auto-sync-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.sync-dot {
    font-size: 10px;
    color: var(--green);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.btn-theme-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-theme-toggle:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--blue);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition);
}

.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 32px;
    background: rgba(6, 6, 15, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    z-index: 50;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: var(--transition);
}

.menu-toggle:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    flex: 1;
}

.input-date {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: var(--radius-xs);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.input-date:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-dim);
}

.input-date::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
}

/* ===== PAGES ===== */
.pages-container {
    padding: 28px 32px;
}

.page { display: none; animation: fadeIn 0.4s ease; }
.page.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== CARDS ===== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    backdrop-filter: blur(10px);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--border-glow);
}

.card-total::before { background: var(--gradient-blue); }
.card-present::before { background: var(--gradient-green); }
.card-late::before { background: var(--gradient-red); }
.card-ontime::before { background: var(--gradient-purple); }

.card-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.card-icon .material-icons-round { font-size: 26px; }

.card-total .card-icon { background: var(--blue-dim); color: var(--blue); }
.card-present .card-icon { background: var(--green-dim); color: var(--green); }
.card-late .card-icon { background: var(--red-dim); color: var(--red); }
.card-ontime .card-icon { background: var(--purple-dim); color: var(--purple); }

.card-info { display: flex; flex-direction: column; gap: 4px; }

.card-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -1px;
}

.card-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== CHARTS ===== */
.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    backdrop-filter: blur(10px);
    overflow: hidden;
    transition: var(--transition);
}

.chart-card:hover { border-color: var(--border-glow); }

.chart-card.full-width { grid-column: 1 / -1; }

.chart-header {
    padding: 20px 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chart-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.chart-badge {
    background: var(--blue-dim);
    color: var(--blue);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.chart-body {
    padding: 20px 24px 24px;
    height: 300px;
}

.chart-body-doughnut {
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== TABLES ===== */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    backdrop-filter: blur(10px);
    overflow: hidden;
    margin-bottom: 28px;
}

.table-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.table-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.entry-time-badge, .badge {
    background: var(--yellow-dim);
    color: var(--yellow);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge {
    background: var(--blue-dim);
    color: var(--blue);
}

.table-responsive { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    padding: 14px 24px;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 14px 24px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: rgba(68, 138, 255, 0.04); }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-ontime {
    background: var(--green-dim);
    color: var(--green);
}

.status-late {
    background: var(--red-dim);
    color: var(--red);
}

.status-absent {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

.punches-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.punch-tag {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: 'Inter', monospace;
}

/* ===== FILTER BAR ===== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-xs);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--gradient-blue);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 4px 16px rgba(68, 138, 255, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover { border-color: var(--blue); }

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-danger {
    background: var(--red-dim);
    color: var(--red);
}

.btn-danger:hover { background: rgba(255, 82, 82, 0.25); }

/* ===== RANKING PODIUM ===== */
.ranking-podium {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 28px;
}

.podium-item {
    text-align: center;
    padding: 24px 32px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    min-width: 160px;
    transition: var(--transition);
    position: relative;
}

.podium-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.podium-item.gold { border-color: #ffd700; }
.podium-item.gold::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(135deg, #ffd700, #ffab00);
    border-radius: var(--radius) var(--radius) 0 0;
}

.podium-item.silver { border-color: #c0c0c0; }
.podium-item.silver::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(135deg, #c0c0c0, #9e9e9e);
    border-radius: var(--radius) var(--radius) 0 0;
}

.podium-item.bronze { border-color: #cd7f32; }
.podium-item.bronze::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(135deg, #cd7f32, #a0522d);
    border-radius: var(--radius) var(--radius) 0 0;
}

.podium-rank {
    font-size: 2rem;
    margin-bottom: 8px;
}

.podium-name {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 4px;
}

.podium-rate {
    font-size: 1.8rem;
    font-weight: 800;
    background: var(--gradient-green);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.podium-days {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== SETTINGS ===== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.settings-card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-card-header .material-icons-round {
    color: var(--blue);
    font-size: 24px;
}

.settings-card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.settings-card-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 6px;
}

.input {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: var(--radius-xs);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-dim);
}

.input::placeholder { color: var(--text-muted); }

.btn-save-settings {
    margin-top: 8px;
    padding: 14px 32px;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 100%;
    max-width: 440px;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 { font-size: 1.1rem; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: var(--transition);
}

.modal-close:hover { background: var(--border-color); color: var(--text-primary); }

.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 18px; }

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ===== SYNC OVERLAY ===== */
.sync-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.sync-overlay.active { display: flex; }

.sync-card {
    text-align: center;
    padding: 48px;
}

.sync-spinner {
    width: 56px;
    height: 56px;
    border: 3px solid var(--border-color);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

.sync-card h3 { font-size: 1.3rem; margin-bottom: 8px; }
.sync-card p { color: var(--text-secondary); }

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(16px);
    animation: toastIn 0.4s ease, toastOut 0.4s ease 3.6s forwards;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 400px;
}

.toast-success {
    background: var(--green-dim);
    border: 1px solid rgba(0, 230, 118, 0.3);
    color: var(--green);
}

.toast-error {
    background: var(--red-dim);
    border: 1px solid rgba(255, 82, 82, 0.3);
    color: var(--red);
}

.toast-info {
    background: var(--blue-dim);
    border: 1px solid rgba(68, 138, 255, 0.3);
    color: var(--blue);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(10px); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .cards-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-close { display: flex; }
    .menu-toggle { display: flex; }
    .main-content { margin-left: 0; }
    .topbar { padding: 0 16px; }
    .pages-container { padding: 20px 16px; }
    .cards-grid { grid-template-columns: 1fr 1fr; }
    .ranking-podium { flex-direction: column; align-items: center; }
    .podium-item { width: 100%; max-width: 280px; }
}

@media (max-width: 480px) {
    .cards-grid { grid-template-columns: 1fr; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }
