:root {
    /* Premium Color Palette */
    --primary-brown: #4a4933; /* Deeper Olive */
    --secondary-brown: #2d2c1e;
    --accent-gold: #d4af37;
    --light-gold: #f4e9cd;
    --background-cream: #fdfbf7;
    --text-dark: #1a1a1a;
    --text-muted: #717171;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --shadow-soft: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --transition-speed: 0.4s;

    /* Fonts */
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;
}

[data-theme="chocolate"] {
    --primary-brown: #3e2723;
    --secondary-brown: #1b0000;
    --accent-gold: #c6a49a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-body);
    background-color: var(--background-cream);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
    background-image: radial-gradient(circle at 10% 20%, rgba(212, 175, 55, 0.05) 0%, transparent 40%),
                      radial-gradient(circle at 90% 80%, rgba(74, 73, 51, 0.05) 0%, transparent 40%);
    background-attachment: fixed;
}

h1, h2, h3 {
    font-family: var(--font-heading);
    letter-spacing: -0.02em;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling - Glassmorphism */
.sidebar {
    width: 280px;
    background-color: var(--primary-brown);
    backdrop-filter: blur(10px);
    color: white;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.05);
}

.brand {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 3.5rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
}

.nav-links {
    list-style: none;
}

.nav-item {
    margin-bottom: 0.75rem;
}

.nav-link {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    padding: 1rem 1.2rem;
    border-radius: 12px;
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link i {
    width: 24px;
    margin-right: 12px;
    font-size: 1.1rem;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(5px);
}

.nav-link.active {
    background: var(--accent-gold);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

/* Main Content Styling */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 3rem 4rem;
    transition: margin var(--transition-speed);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4rem;
}

.welcome h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--secondary-brown);
}

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

.theme-switchers {
    display: flex;
    gap: 0.8rem;
    background: white;
    padding: 0.5rem;
    border-radius: 50px;
    box-shadow: var(--shadow-soft);
}

.btn {
    padding: 0.7rem 1.4rem;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-family: var(--font-body);
    font-size: 0.85rem;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    background-color: var(--secondary-brown);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Grid & Cards */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2.5rem;
    animation: fadeIn 0.8s ease-out;
}

.card {
    background: white;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    border: 1px solid #f0f0f0;
    transition: all var(--transition-speed) cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
}

.card:hover {
    transform: translateY(-12px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

.card-img {
    height: 180px;
    background: linear-gradient(45deg, var(--primary-brown), var(--secondary-brown));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-family: var(--font-heading);
    font-size: 1.4rem;
    text-align: center;
    padding: 2rem;
    position: relative;
}

.card-img::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 0;
    width: 100%;
    height: 30px;
    background: white;
    border-radius: 50% 50% 0 0;
}

.card-content {
    padding: 2rem;
}

.card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
    color: var(--primary-brown);
}

/* Form Styling */
.form-section {
    max-width: 700px;
    margin: 2rem auto;
    background: white;
    padding: 4rem;
    border-radius: 32px;
    box-shadow: var(--shadow-soft);
}

.form-header {
    margin-bottom: 3rem;
    text-align: center;
}

.form-header h1 {
    font-size: 2.2rem;
    color: var(--primary-brown);
}

/* Tracker Styling */
.tracker-grid {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.2rem;
}

.tracker-item {
    flex: 1;
    aspect-ratio: 1;
    border: 2px solid #edeff2;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    background: #fcfcfd;
}

.tracker-item:hover {
    border-color: var(--accent-gold);
    background: #fff;
    transform: scale(1.05);
}

.tracker-item.active {
    background-color: var(--accent-gold);
    border-color: var(--accent-gold);
    color: white;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

/* Insight Results */
.insight-card {
    background: var(--light-gold);
    color: var(--primary-brown);
    padding: 2.5rem;
    border-radius: 24px;
    margin-top: 3rem;
    display: none;
    border-left: 5px solid var(--accent-gold);
}

.insight-card h3 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1rem;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

/* Animations & Utility */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.view { display: none; }
.view.active { display: block; animation: fadeIn 0.5s ease; }

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .sidebar { width: 80px; padding: 2rem 0.5rem; }
    .sidebar .brand, .nav-link span { display: none; }
    .main-content { margin-left: 80px; padding: 2rem; }
    .nav-link i { margin-right: 0; }
}

@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; padding: 1rem; }
    .sidebar .brand { display: block; margin-bottom: 1rem; }
    .nav-links { display: flex; justify-content: center; gap: 1rem; }
    .main-content { margin-left: 0; }
    header { flex-direction: column; gap: 1.5rem; }
}