/* ===== ROOT VARIABLES ===== */
:root {
    --primary-color: #4f46e5;
    --primary-light: #eef2ff;
    --primary-dark: #3730a3;
    --sidebar-width: 240px;
    --header-height: 64px;
    --font: 'Inter', sans-serif;
    --radius: 10px;
    --shadow: 0 4px 20px rgba(0,0,0,0.06);
    --shadow-md: 0 8px 30px rgba(0,0,0,0.10);
    --bg: #f5f7fa;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; }

/* ===== LAYOUT ===== */
.app-container { display: flex; flex-direction: column; min-height: 100vh; }
.app-header {
    height: var(--header-height); background: var(--card-bg);
    border-bottom: 1px solid var(--border); padding: 0 24px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow);
}
.app-header .logo h2 { font-size: 1.2rem; font-weight: 700; color: var(--primary-color); }
.user-actions { display: flex; align-items: center; gap: 14px; }
.app-main { display: flex; flex: 1; }
.app-sidebar {
    width: var(--sidebar-width); background: var(--card-bg);
    border-right: 1px solid var(--border); min-height: calc(100vh - var(--header-height));
    position: sticky; top: var(--header-height); height: calc(100vh - var(--header-height));
    overflow-y: auto; flex-shrink: 0;
}
.nav-menu { list-style: none; padding: 12px 0; }
.nav-menu li a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px; text-decoration: none;
    color: var(--text-muted); font-weight: 500; font-size: 0.88rem;
    transition: all 0.2s; border-left: 3px solid transparent;
}
.nav-menu li a:hover, .nav-menu li a.active {
    background: var(--primary-light); color: var(--primary-color);
    border-left-color: var(--primary-color);
}
.nav-menu li a i { width: 18px; text-align: center; }
.app-content { flex: 1; padding: 24px; overflow-x: hidden; }
.auth-content { min-height: 100vh; }

/* ===== CARDS ===== */
.card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 24px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.card-title { font-size: 1.15rem; font-weight: 700; color: var(--text); }

/* ===== GRID ===== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ===== STAT WIDGETS ===== */
.stat-widget {
    background: var(--card-bg); border-radius: var(--radius); padding: 20px;
    display: flex; align-items: center; gap: 16px;
    box-shadow: var(--shadow); border-left: 4px solid var(--primary-color);
}
.stat-icon { width: 52px; height: 52px; border-radius: 12px; background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; color: var(--primary-color); flex-shrink: 0; }
.stat-content h3 { font-size: 1.8rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-content p { font-size: 0.82rem; color: var(--text-muted); margin-top: 4px; font-weight: 500; }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 8px; font-size: 0.875rem; font-weight: 600; cursor: pointer; border: none; transition: all 0.2s; text-decoration: none; }
.btn-primary { background: var(--primary-color); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79,70,229,0.4); }
.btn-success { background: #10b981; color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-secondary { background: #f1f5f9; color: #475569; border: 1px solid var(--border); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; border-radius: 6px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 0.82rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.form-control { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px; font-family: var(--font); font-size: 0.9rem; background: #fff; color: var(--text); transition: border-color 0.2s, box-shadow 0.2s; }
.form-control:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }

/* ===== TABLES ===== */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th { background: var(--primary-light); color: var(--primary-color); padding: 10px 14px; text-align: left; font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbff; }

/* ===== BADGES ===== */
.badge { display: inline-block; padding: 3px 9px; border-radius: 30px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-gray    { background: #f1f5f9; color: #475569; }

/* ===== MODALS ===== */
.modal { display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.55); z-index: 1000; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
.modal.open { display: flex; }
.modal-box { background: #fff; border-radius: 16px; padding: 28px; width: 520px; max-width: 94vw; max-height: 92vh; overflow-y: auto; box-shadow: 0 24px 64px rgba(0,0,0,0.18); animation: slideUp 0.25s ease; }
.modal-box.lg { width: 720px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); line-height: 1; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ===== TOAST ===== */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast { background: #1e293b; color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 0.88rem; font-weight: 500; min-width: 260px; box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 10px; animation: toastIn 0.3s ease; }
.toast.success { background: #10b981; }
.toast.error   { background: #ef4444; }
.toast.warning { background: #f59e0b; }
@keyframes toastIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ===== LOADER ===== */
.loader-overlay { position: fixed; inset: 0; background: rgba(255,255,255,0.7); z-index: 9998; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(2px); }
.spinner { width: 40px; height: 40px; border: 4px solid var(--border); border-top-color: var(--primary-color); border-radius: 50%; animation: spin 0.75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== THEME DOTS ===== */
.theme-selector { display: flex; gap: 7px; align-items: center; }
.theme-dot { width: 20px; height: 20px; border-radius: 50%; cursor: pointer; border: 2.5px solid transparent; transition: transform 0.2s; display: inline-block; }
.theme-dot:hover { transform: scale(1.25); }
.t1 { background: #4f46e5; }
.t2 { background: #0ea5e9; }
.t3 { background: #10b981; }
.t4 { background: #f59e0b; }
.t5 { background: #ec4899; }

/* ===== LANDING PAGE ===== */
.landing { background: #0f172a; min-height: 100vh; }
.landing-nav { padding: 20px 60px; display: flex; justify-content: space-between; align-items: center; }
.landing-nav .brand { color: #fff; font-size: 1.4rem; font-weight: 800; }
.landing-hero { padding: 100px 60px; max-width: 900px; margin: 0 auto; text-align: center; }
.landing-hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 900; color: #fff; margin-bottom: 20px; line-height: 1.15; }
.landing-hero p { font-size: 1.1rem; color: #94a3b8; margin-bottom: 40px; max-width: 600px; margin-left: auto; margin-right: auto; }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; padding: 60px; max-width: 900px; margin: 0 auto; }
.pricing-card { background: #1e293b; border-radius: 20px; padding: 36px 30px; text-align: center; border: 1px solid #334155; transition: transform 0.3s; }
.pricing-card:hover { transform: translateY(-6px); }
.pricing-card.featured { border-color: var(--primary-color); box-shadow: 0 0 0 2px var(--primary-color); }
.pricing-card h3 { color: #94a3b8; text-transform: uppercase; letter-spacing: 1px; font-size: 0.85rem; margin-bottom: 12px; }
.pricing-card .price { font-size: 3rem; font-weight: 900; color: #fff; margin-bottom: 8px; }
.pricing-card .price span { font-size: 1.2rem; font-weight: 400; color: #94a3b8; }
.pricing-card p { color: #64748b; margin-bottom: 24px; }

/* ===== AUTH FORMS ===== */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 20px; }
.auth-card { background: #fff; border-radius: 20px; padding: 40px; width: 440px; max-width: 100%; box-shadow: 0 24px 64px rgba(0,0,0,0.2); }
.auth-card h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 6px; color: var(--text); }
.auth-card p { color: var(--text-muted); margin-bottom: 28px; font-size: 0.9rem; }

/* ===== ANALOG CLOCK ===== */
.clock-wrap { display: flex; flex-direction: column; align-items: center; }
.clock-face { width: 130px; height: 130px; border-radius: 50%; background: #fff; border: 4px solid var(--primary-color); position: relative; box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.clock-face .hand { position: absolute; bottom: 50%; left: 50%; transform-origin: bottom center; border-radius: 4px; transform: rotate(0deg); }
.hour-hand   { width: 4px; height: 35px; background: #1e293b; margin-left: -2px; }
.minute-hand { width: 3px; height: 46px; background: #475569; margin-left: -1.5px; }
.second-hand { width: 2px; height: 50px; background: var(--primary-color); margin-left: -1px; }
.clock-center { position: absolute; width: 10px; height: 10px; background: var(--primary-color); border-radius: 50%; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 10; }

/* ===== CALCULATOR ===== */
.calc-wrap { background: #1e293b; border-radius: 16px; padding: 16px; width: 220px; }
.calc-screen { background: #0f172a; color: #fff; border-radius: 10px; padding: 10px 14px; text-align: right; font-size: 1.6rem; font-weight: 700; margin-bottom: 12px; min-height: 54px; word-break: break-all; }
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.calc-key { padding: 12px 0; text-align: center; border-radius: 8px; cursor: pointer; font-size: 0.9rem; font-weight: 600; transition: all 0.15s; border: none; }
.calc-key.num { background: #334155; color: #fff; }
.calc-key.op  { background: #4f46e5; color: #fff; }
.calc-key.eq  { background: #10b981; color: #fff; }
.calc-key.clr { background: #ef4444; color: #fff; }
.calc-key:active { transform: scale(0.93); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    :root { --sidebar-width: 0px; }
    .app-sidebar { display: none; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .landing-nav, .landing-hero, .pricing-grid { padding: 20px; }
    .app-header { padding: 0 16px; }
    .app-content { padding: 16px; }
}
