/* GEA Tools Services */

/* ── Tokens ── */
:root {
    --bg: hsl(0 0% 100%);
    --fg: hsl(0 0% 3.9%);
    --muted: hsl(0 0% 96.1%);
    --muted-fg: hsl(0 0% 45.1%);
    --border: hsl(0 0% 89.8%);
    --input: hsl(0 0% 89.8%);
    --ring: hsl(0 0% 3.9%);
    --accent: hsl(0 0% 96.1%);
    --accent-fg: hsl(0 0% 9%);
    --primary: #007AFF;
    --primary-fg: #fff;
    --success: #34C759;
    --danger: #FF3B30;
    --warning: #FF9500;
    --info: #5AC8FA;
    --purple: #AF52DE;
    --radius: 10px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --topbar-h: 28px;
    --dock-h: 70px;
}

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

html, body {
    width: 100%; height: 100%; overflow: hidden;
    font-family: var(--font);
    font-size: 13px;
    color: var(--fg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.18); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.28); }

/* ── Desktop ── */
.desktop {
    width: 100%; height: 100%;
    background-color: #0a0e27;
    background-image:
        radial-gradient(ellipse at 20% 50%, #1a1050 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, #2d1654 0%, transparent 50%),
        radial-gradient(ellipse at 60% 80%, #0c2340 0%, transparent 50%),
        radial-gradient(ellipse at 40% 30%, #1b0a3a 0%, transparent 70%);
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ── Top Bar ── */
.topbar {
    height: var(--topbar-h);
    background: rgba(0,0,0,.52);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 14px;
    color: rgba(255,255,255,.92);
    font-size: 12.5px; font-weight: 500;
    z-index: 9000; user-select: none; flex-shrink: 0;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-logo { font-weight: 700; font-size: 12.5px; }
.topbar-menu-item { opacity: .8; cursor: default; transition: opacity .15s; }
.topbar-menu-item:hover { opacity: 1; }
.topbar-clock { font-variant-numeric: tabular-nums; opacity: .85; }
.topbar-username { opacity: .85; }
.topbar-separator { opacity: .3; }
.topbar-logout { color: rgba(255,255,255,.8); text-decoration: none; cursor: pointer; transition: opacity .15s; }
.topbar-logout:hover { opacity: 1; }

/* ── Workspace ── */
.workspace { flex: 1; position: relative; overflow: hidden; }

/* ── Windows ── */
.app-window {
    position: absolute;
    background: #f0f0f0;
    border-radius: 12px;
    box-shadow: 0 0 0 .5px rgba(0,0,0,.12), 0 8px 40px rgba(0,0,0,.35), 0 2px 12px rgba(0,0,0,.2);
    display: flex; flex-direction: column;
    min-width: 380px; min-height: 260px;
    overflow: hidden; z-index: 100;
    opacity: 0; transform: scale(.88);
    transition: opacity .3s cubic-bezier(.16,1,.3,1), transform .3s cubic-bezier(.16,1,.3,1);
}
.app-window.visible { opacity: 1; transform: scale(1); }
.app-window.active { z-index: 200; box-shadow: 0 0 0 .5px rgba(0,0,0,.15), 0 12px 50px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.25); }
.app-window.maximized { top: 6px !important; left: 6px !important; width: calc(100% - 12px) !important; height: calc(100% - 12px) !important; border-radius: 10px; transition: all .3s cubic-bezier(.16,1,.3,1); }
.app-window.closing { opacity: 0; transform: scale(.92); transition: all .2s ease-in; }
.app-window.minimizing { opacity: 0; transform: scale(.4) translateY(200px); transition: all .45s cubic-bezier(.4,1,.6,1); }

/* Resize handles */
.resize-handle { position: absolute; z-index: 10; }
.resize-handle-n  { top: -3px; left: 8px; right: 8px; height: 6px; cursor: n-resize; }
.resize-handle-s  { bottom: -3px; left: 8px; right: 8px; height: 6px; cursor: s-resize; }
.resize-handle-w  { left: -3px; top: 8px; bottom: 8px; width: 6px; cursor: w-resize; }
.resize-handle-e  { right: -3px; top: 8px; bottom: 8px; width: 6px; cursor: e-resize; }
.resize-handle-nw { top: -3px; left: -3px; width: 12px; height: 12px; cursor: nw-resize; }
.resize-handle-ne { top: -3px; right: -3px; width: 12px; height: 12px; cursor: ne-resize; }
.resize-handle-sw { bottom: -3px; left: -3px; width: 12px; height: 12px; cursor: sw-resize; }
.resize-handle-se { bottom: -3px; right: -3px; width: 12px; height: 12px; cursor: se-resize; }

/* ── Title Bar ── */
.window-titlebar {
    height: 38px;
    background: linear-gradient(180deg, #e8e8e8 0%, #d6d6d6 100%);
    border-bottom: 1px solid #c0c0c0;
    display: flex; align-items: center; padding: 0 12px;
    cursor: default; user-select: none; flex-shrink: 0; position: relative;
}
.app-window.active .window-titlebar { background: linear-gradient(180deg, #f6f6f6 0%, #e2e2e2 100%); }
.app-window:not(.active) .window-titlebar { background: #ececec; }
.app-window:not(.active) .window-control { background: #ccc !important; }
.app-window:not(.active) .window-control::after { opacity: 0 !important; }

.window-controls { display: flex; gap: 7px; z-index: 1; }
.window-control {
    width: 12px; height: 12px; border-radius: 50%; border: none;
    cursor: pointer; position: relative; transition: filter .1s;
}
.window-control::after {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    opacity: 0; transition: opacity .1s; font-weight: 700; line-height: 1; color: rgba(0,0,0,.55);
}
.window-titlebar:hover .window-control::after { opacity: 1; }
.window-control.close { background: #ff5f57; }
.window-control.close::after { content: '×'; font-size: 9px; }
.window-control.minimize { background: #febc2e; }
.window-control.minimize::after { content: '−'; font-size: 10px; }
.window-control.maximize { background: #28c840; }
.window-control.maximize::after { content: '+'; font-size: 9px; }

.window-title {
    position: absolute; left: 50%; transform: translateX(-50%);
    font-size: 12.5px; font-weight: 600; color: #333;
    white-space: nowrap; display: flex; align-items: center; gap: 5px;
}
.window-title i { font-size: 14px; }
.app-window:not(.active) .window-title { color: #888; }

.window-content { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 20px 24px; background: #fff; position: relative; }
.window-content:has(> .permission-denied) { display: flex; padding: 0; }
.window-content > .permission-denied { flex: 1; }

/* ── Dock ── */
.dock {
    position: fixed; bottom: 6px; left: 50%; transform: translateX(-50%);
    display: flex; align-items: flex-end; gap: 3px;
    padding: 5px 8px;
    background: rgba(255,255,255,.18);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 18px;
    z-index: 9999;
}
.dock-item {
    width: 48px; height: 48px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; position: relative; color: #fff; font-size: 22px;
    transition: transform .2s cubic-bezier(.16,1,.3,1);
}
.dock-item[data-app="dashboard"]     { background: linear-gradient(135deg, #3a7bd5, #5e6bde); }
.dock-item[data-app="time-records"]  { background: linear-gradient(135deg, #34a853, #43c06f); }
.dock-item[data-app="users"]         { background: linear-gradient(135deg, #f5a623, #f7c948); }
.dock-item[data-app="roles"]         { background: linear-gradient(135deg, #9b51e0, #b86edf); }
.dock-item:hover { transform: translateY(-8px) scale(1.18); }

.dock-tooltip {
    position: absolute; bottom: calc(100% + 8px); left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: rgba(0,0,0,.78); color: #fff;
    padding: 3px 10px; border-radius: 5px;
    font-size: 11px; font-weight: 500; white-space: nowrap;
    opacity: 0; visibility: hidden; transition: all .15s ease; pointer-events: none;
}
.dock-item:hover .dock-tooltip { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.dock-item.active::after {
    content: ''; position: absolute; bottom: -3px; left: 50%; transform: translateX(-50%);
    width: 4px; height: 4px; border-radius: 50%; background: rgba(255,255,255,.85);
}
.dock-separator { width: 1px; height: 34px; background: rgba(255,255,255,.2); margin: 0 4px; align-self: center; }

/* ── Notifications ── */
.notification-container {
    position: fixed; top: calc(var(--topbar-h) + 10px); right: 14px;
    z-index: 99999; display: flex; flex-direction: column; gap: 6px; max-width: 360px;
}
.notification {
    display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
    border-radius: var(--radius); background: #fff;
    box-shadow: 0 4px 24px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.05);
    animation: notif-in .3s cubic-bezier(.16,1,.3,1);
    cursor: pointer; font-size: 13px; line-height: 1.4;
}
.notification:hover { transform: translateX(-2px); }
.notification.removing { animation: notif-out .25s ease forwards; }
@keyframes notif-in { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes notif-out { to { opacity: 0; transform: translateX(100%); } }
.notification-icon { flex-shrink: 0; font-size: 18px; line-height: 1; margin-top: 1px; }
.notification.success .notification-icon { color: var(--success); }
.notification.error .notification-icon   { color: var(--danger); }
.notification.warning .notification-icon { color: var(--warning); }
.notification.info .notification-icon    { color: var(--info); }
.notification-text { flex: 1; color: var(--fg); font-weight: 500; }
.notification-close { background: none; border: none; cursor: pointer; color: #999; font-size: 16px; padding: 0; line-height: 1; }
.notification-close:hover { color: #333; }

/* ── Modal ── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.35); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 50000; opacity: 0; visibility: hidden; transition: all .2s ease;
}
.modal-overlay.visible { opacity: 1; visibility: visible; }
.modal-dialog {
    background: #fff; border-radius: 14px; padding: 28px;
    max-width: 520px; width: 92%; box-shadow: 0 20px 60px rgba(0,0,0,.25);
    transform: scale(.94); transition: transform .25s cubic-bezier(.16,1,.3,1);
}
.modal-overlay.visible .modal-dialog { transform: scale(1); }
.modal-title { font-size: 17px; font-weight: 700; color: var(--fg); margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ── Dashboard ── */
.welcome-section { margin-bottom: 24px; }
.welcome-title { font-size: 24px; font-weight: 700; color: var(--fg); letter-spacing: -.3px; }
.welcome-subtitle { font-size: 13.5px; color: var(--muted-fg); margin-top: 3px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 28px; }
.stat-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; transition: box-shadow .2s, transform .2s; }
.stat-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,.06); transform: translateY(-1px); }
.stat-card-icon { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 17px; margin-bottom: 14px; }
.stat-card-icon.blue   { background: rgba(0,122,255,.1);  color: var(--primary); }
.stat-card-icon.green  { background: rgba(52,199,89,.1);  color: var(--success); }
.stat-card-icon.orange { background: rgba(255,149,0,.1);  color: var(--warning); }
.stat-card-icon.purple { background: rgba(175,82,222,.1); color: var(--purple); }
.stat-card-value { font-size: 26px; font-weight: 700; color: var(--fg); line-height: 1; margin-bottom: 3px; }
.stat-card-label { font-size: 11.5px; color: var(--muted-fg); font-weight: 500; text-transform: uppercase; letter-spacing: .4px; }
.section-title { font-size: 15px; font-weight: 700; color: var(--fg); margin-bottom: 14px; }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.quick-action { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px 14px; background: var(--muted); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: all .2s; text-align: center; }
.quick-action:hover { background: var(--bg); box-shadow: 0 2px 10px rgba(0,0,0,.06); transform: translateY(-2px); }
.quick-action-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.quick-action-label { font-size: 12px; font-weight: 600; color: var(--accent-fg); }
.info-box { margin-top: 28px; padding: 16px; background: var(--muted); border: 1px solid var(--border); border-radius: var(--radius); }
.info-box-title { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.info-box p { font-size: 12.5px; color: var(--muted-fg); line-height: 1.5; }

/* ── Tables ── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th { background: var(--muted); padding: 9px 14px; text-align: left; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted-fg); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1; }
.data-table tbody tr { transition: background .1s; }
.data-table tbody tr:hover { background: var(--muted); }
.data-table tbody td { padding: 9px 14px; border-bottom: 1px solid var(--border); color: var(--fg); }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-success { background: rgba(52,199,89,.1);  color: #1a7d36; }
.badge-danger  { background: rgba(255,59,48,.1);  color: #c5221f; }
.badge-warning { background: rgba(255,149,0,.1);  color: #b36b00; }
.badge-info    { background: rgba(90,200,250,.1);  color: #0a6ebd; }
.badge-primary { background: rgba(0,122,255,.1);  color: #005ec4; }
.badge-purple  { background: rgba(175,82,222,.1); color: #7b34b8; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px; border: none; border-radius: 7px; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all .15s; font-family: var(--font); line-height: 1.2; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #0066dd; box-shadow: 0 2px 8px rgba(0,122,255,.25); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #2db84d; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #e03028; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-ghost { background: var(--muted); color: var(--accent-fg); }
.btn-ghost:hover { background: var(--border); }
.btn-sm { padding: 4px 9px; font-size: 11.5px; border-radius: 6px; }

/* ── Forms ── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted-fg); margin-bottom: 5px; }
.form-input, .form-select { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 7px; font-size: 13px; font-family: var(--font); color: var(--fg); background: var(--bg); outline: none; transition: border-color .15s, box-shadow .15s; }
.form-input:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,122,255,.12); }
.form-input::placeholder { color: #bbb; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Toggle ── */
.toggle-switch { position: relative; width: 40px; height: 22px; cursor: pointer; display: inline-block; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: #ccc; border-radius: 22px; transition: background .2s; }
.toggle-slider::before { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── Toolbar ── */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar-title { font-size: 15px; font-weight: 700; color: var(--fg); margin-right: auto; display: flex; align-items: center; gap: 6px; }
.toolbar-title i { font-size: 17px; }
.toolbar-search-wrapper { position: relative; }
.toolbar-search-wrapper i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 15px; color: #999; pointer-events: none; }
.toolbar-search { padding: 6px 10px 6px 32px; border: 1px solid var(--border); border-radius: 7px; font-size: 12.5px; font-family: var(--font); width: 200px; background: var(--bg); outline: none; transition: border-color .15s, box-shadow .15s, width .2s; }
.toolbar-search:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,122,255,.1); width: 260px; }

/* ── Period Selector ── */
.period-selector { display: flex; gap: 2px; background: var(--muted); border-radius: 8px; padding: 2px; }
.period-btn { padding: 5px 12px; border: none; border-radius: 6px; background: transparent; font-size: 11.5px; font-weight: 600; color: var(--muted-fg); cursor: pointer; transition: all .15s; font-family: var(--font); }
.period-btn.active, .period-btn:hover { background: var(--bg); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ── Time Records ── */
.time-record-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 8px; transition: all .15s; cursor: pointer; background: var(--bg); }
.time-record-card:hover { border-color: #ccc; box-shadow: 0 1px 6px rgba(0,0,0,.05); }
.time-record-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.time-record-date { font-size: 14px; font-weight: 700; color: var(--fg); }
.time-record-hours { font-size: 17px; font-weight: 700; color: var(--primary); }
.time-record-meta { display: flex; gap: 12px; font-size: 12px; color: var(--muted-fg); align-items: center; }
.time-record-meta i { font-size: 14px; vertical-align: -1px; }

.line-header { display: grid; grid-template-columns: 95px 95px 120px 1fr 1fr auto; gap: 6px; padding: 4px 0; font-size: 11px; font-weight: 600; color: var(--muted-fg); text-transform: uppercase; letter-spacing: .3px; }
.line-row { display: grid; grid-template-columns: 95px 95px 120px 1fr 1fr auto; gap: 6px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.line-row:last-child { border-bottom: none; }
.line-row .form-input, .line-row .form-select { padding: 6px 8px; font-size: 12px; }

/* ── Permissions ── */
.permission-category { margin-bottom: 20px; }
.permission-category-title { font-size: 13px; font-weight: 700; color: var(--fg); margin-bottom: 10px; padding-bottom: 5px; border-bottom: 2px solid var(--primary); text-transform: capitalize; }
.permission-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-radius: 7px; margin-bottom: 4px; }
.permission-item:hover { background: var(--muted); }
.permission-name { font-size: 12.5px; font-weight: 600; color: var(--fg); }
.permission-desc { font-size: 11px; color: var(--muted-fg); margin-top: 1px; }

.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }

/* ── Empty / Denied ── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted-fg); }
.empty-state-icon { font-size: 40px; margin-bottom: 12px; opacity: .4; }
.empty-state-text { font-size: 15px; font-weight: 600; color: var(--fg); margin-bottom: 4px; }
.empty-state-desc { font-size: 12.5px; }

.permission-denied {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; height: 100%; min-height: 100%; padding: 20px;
}
.permission-denied-icon { font-size: 56px; color: var(--danger); margin-bottom: 18px; opacity: .6; }
.permission-denied-title { font-size: 17px; font-weight: 700; color: var(--fg); margin-bottom: 8px; }
.permission-denied-detail { font-size: 12.5px; color: var(--muted-fg); }
.permission-denied-detail code { background: var(--muted); padding: 2px 8px; border-radius: 4px; font-size: 12px; font-family: 'SF Mono', monospace; }

/* ── Login ── */
body.login-page { font-family: var(--font); height: 100vh; overflow: hidden; display: flex; background: #fff; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .dock-item { width: 40px; height: 40px; font-size: 18px; border-radius: 9px; }
    .dock { padding: 4px 6px; border-radius: 14px; gap: 2px; }
    .app-window { min-width: 300px; min-height: 220px; }
    .line-row, .line-header { grid-template-columns: 1fr 1fr; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-search { width: 100%; }
    .form-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
