/* ============================================================
   ToolKit — Shared Design System
   Neumorphism + Glassmorphism + Dark UI
   ============================================================ */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

/* --- Design Tokens --- */
:root {
    /* Backgrounds */
    --bg-base: #0a0a0f;
    --bg-surface: #101018;
    --bg-elevated: #16161f;
    --bg-hover: #1e1e2a;
    --bg-card: rgba(18, 18, 28, 0.6);
    --bg-glass: rgba(18, 18, 28, 0.6);
    --bg-glass-hover: rgba(255, 255, 255, 0.05);

    /* Borders */
    --border-glass: rgba(255, 255, 255, 0.06);
    --border-glass-mid: rgba(255, 255, 255, 0.1);
    --border-glass-hover: rgba(255, 255, 255, 0.16);

    /* Text */
    --text-primary: #e8e6f0;
    --text-secondary: #9896a6;
    --text-muted: #5c5a6b;

    /* Accent */
    --accent: #a78bfa;
    --accent-hover: #c4b5fd;
    --accent-muted: #6d5cdb;
    --accent-glow: rgba(167, 139, 250, 0.35);
    --accent-subtle: rgba(167, 139, 250, 0.1);

    /* Semantic */
    --success: #4ade80;
    --success-subtle: rgba(74, 222, 128, 0.1);
    --danger: #f87171;
    --danger-subtle: rgba(248, 113, 113, 0.1);
    --favorite: #f472b6;

    /* Gradients */
    --gradient-brand: linear-gradient(135deg, #a78bfa 0%, #6d5cdb 50%, #4338ca 100%);
    --gradient-accent: linear-gradient(135deg, #a78bfa 0%, #6d5cdb 100%);
    --gradient-pink: linear-gradient(135deg, #f472b6 0%, #a78bfa 100%);
    --gradient-card: linear-gradient(160deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.01) 40%, transparent 100%);

    /* Shadows — Neumorphism */
    --shadow-neu: 12px 12px 32px rgba(0, 0, 0, 0.7), -6px -6px 20px rgba(255, 255, 255, 0.015);
    --shadow-neu-inset: inset 3px 3px 8px rgba(0, 0, 0, 0.5), inset -3px -3px 8px rgba(255, 255, 255, 0.025);
    --shadow-glow: 0 0 50px rgba(167, 139, 250, 0.18), 0 0 100px rgba(167, 139, 250, 0.06);
    --shadow-glow-sm: 0 0 20px rgba(167, 139, 250, 0.2);

    /* Radii */
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 10px;

    /* Typography */
    --font-display: 'Space Grotesk', -apple-system, sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;

    /* Motion */
    --transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html, body {
    background: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- Glass Mixins (via classes) --- */
.glass {
    background: var(--bg-glass);
    backdrop-filter: blur(30px) saturate(1.3);
    -webkit-backdrop-filter: blur(30px) saturate(1.3);
    border: 1px solid var(--border-glass);
}

.glass-light {
    background: rgba(10, 10, 15, 0.5);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border-bottom: 1px solid var(--border-glass);
}

.glass-heavy {
    background: rgba(16, 16, 24, 0.85);
    backdrop-filter: blur(40px) saturate(1.5);
    -webkit-backdrop-filter: blur(40px) saturate(1.5);
    border: 1px solid var(--border-glass-mid);
}

/* --- Neumorphic Card --- */
.neu-card {
    background: var(--bg-card);
    backdrop-filter: blur(30px) saturate(1.3);
    -webkit-backdrop-filter: blur(30px) saturate(1.3);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-neu);
    position: relative;
    overflow: hidden;
}

/* Highlight sheen */
.neu-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--gradient-card);
    pointer-events: none;
    z-index: 1;
}

/* Inner bevel */
.neu-card::after {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.04);
    pointer-events: none;
    z-index: 1;
}

.neu-card > * { position: relative; z-index: 2; }

.neu-card:hover,
a.neu-card:hover {
    border-color: var(--border-glass-hover);
}

/* --- Neumorphic Inset (inputs, icon wells) --- */
.neu-inset {
    background: var(--bg-base);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-neu-inset);
}

/* --- Ambient Background Orbs --- */
.bg-orbs {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.bg-orbs::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    opacity: 0.4;
    mix-blend-mode: overlay;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    animation: orb-float 25s ease-in-out infinite;
}

.orb-1 {
    width: 700px; height: 700px;
    background: radial-gradient(circle, #a78bfa 0%, transparent 70%);
    opacity: 0.12;
    top: -250px; left: -150px;
}

.orb-2 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, #f472b6 0%, transparent 70%);
    opacity: 0.1;
    bottom: -200px; right: -150px;
    animation-delay: -8s;
}

.orb-3 {
    width: 450px; height: 450px;
    background: radial-gradient(circle, #6d5cdb 0%, transparent 70%);
    opacity: 0.08;
    top: 35%; left: 45%;
    animation-delay: -16s;
}

@keyframes orb-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(40px, -40px) scale(1.06); }
    66% { transform: translate(-25px, 25px) scale(0.94); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--accent-glow); }
    50% { opacity: 0.4; box-shadow: 0 0 2px var(--accent-glow); }
}

/* --- Buttons --- */
.btn {
    background: var(--accent);
    color: var(--bg-base);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.85rem;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.55rem 1.1rem;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-neu);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.btn-secondary:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-glass-hover);
}

.btn-danger { background: var(--danger); }
.btn-small { font-size: 0.78rem; padding: 0.4rem 0.75rem; }

.btn-ghost {
    background: none;
    box-shadow: none;
    color: var(--text-muted);
    padding: 0.3rem;
}

.btn-ghost:hover {
    background: none;
    box-shadow: none;
    color: var(--text-primary);
    transform: none;
}

/* --- Form Elements --- */
.input,
input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
textarea,
select {
    background: var(--bg-base);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.9rem;
    transition: all var(--transition);
    box-shadow: var(--shadow-neu-inset);
    width: 100%;
}

.input:focus,
input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: var(--shadow-neu-inset), 0 0 0 3px var(--accent-subtle), 0 0 20px rgba(167, 139, 250, 0.08);
}

textarea {
    min-height: 200px;
    line-height: 1.5;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239896a6' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    padding-right: 2.2rem;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
}

label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.82rem;
    display: block;
    margin-bottom: 0.35rem;
}

/* --- App Header (glass bar) --- */
.app-header {
    background: rgba(10, 10, 15, 0.5);
    backdrop-filter: blur(30px) saturate(1.4);
    -webkit-backdrop-filter: blur(30px) saturate(1.4);
    border-bottom: 1px solid var(--border-glass);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.app-header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.back-home {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    transition: all var(--transition);
}

.back-home:hover {
    color: var(--text-primary);
    border-color: var(--border-glass-hover);
    background: var(--bg-glass-hover);
}

.logo {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin: 0;
}

.logo span {
    background: var(--gradient-pink);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --- Modal System --- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

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

.modal {
    background: rgba(16, 16, 24, 0.85);
    backdrop-filter: blur(40px) saturate(1.5);
    -webkit-backdrop-filter: blur(40px) saturate(1.5);
    border: 1px solid var(--border-glass-mid);
    border-radius: var(--radius-xl);
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-neu), 0 30px 80px rgba(0, 0, 0, 0.5);
    position: relative;
}

.modal::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-xl);
    background: var(--gradient-card);
    pointer-events: none;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1;
}

.modal-header h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: none;
    padding: 0.25rem;
    line-height: 1;
}

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

.modal-body { padding: 1.5rem; }

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-glass);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* --- Tags / Pills --- */
.tag {
    background: rgba(167, 139, 250, 0.08);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 500;
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
    border: 1px solid rgba(167, 139, 250, 0.18);
    box-shadow: inset 1px 1px 3px rgba(0,0,0,0.15), 0 0 6px rgba(167, 139, 250, 0.05);
    display: inline-block;
}

.tag-success {
    background: var(--success-subtle);
    color: var(--success);
    border-color: rgba(74, 222, 128, 0.2);
    box-shadow: inset 1px 1px 3px rgba(0,0,0,0.15), 0 0 6px rgba(74, 222, 128, 0.05);
}

.tag-danger {
    background: var(--danger-subtle);
    color: var(--danger);
    border-color: rgba(248, 113, 113, 0.2);
    box-shadow: inset 1px 1px 3px rgba(0,0,0,0.15), 0 0 6px rgba(248, 113, 113, 0.05);
}

/* --- Layout Utilities --- */
.page-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.hidden { display: none !important; }

/* --- Form Layout --- */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.25rem;
}

.form-group:last-child { margin-bottom: 0; }
.form-group input,
.form-group textarea,
.form-group select { margin: 0; }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state h2,
.empty-state h3 {
    font-family: var(--font-display);
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* --- Tabs --- */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-glass);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s ease;
    box-shadow: none;
}

.tab:hover {
    color: var(--text-secondary);
    background: none;
    box-shadow: none;
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: none;
    box-shadow: none;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* --- Section Footer --- */
.site-footer {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78rem;
    border-top: 1px solid var(--border-glass);
    background: rgba(10, 10, 15, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* --- Responsive Base --- */
@media (max-width: 640px) {
    .app-header-inner {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    .logo-group { justify-content: center; }
}
