:root {
    --bg-color: #0f111a;
    /* Deep Matte Navy-Black */
    --sidebar-bg: #161922;
    /* Slightly lighter sidebar */
    --card-bg: #1c202b;
    /* Professional Slate surface */
    --text-primary: #e6e9ef;
    /* Soft White (Reduced glare) */
    --text-secondary: #9499a5;
    /* Muted Slate Gray */
    --accent-color: #4c6ef5;
    /* Softer Royal Blue */
    --accent-hover: #5c7cfa;
    /* Lighter highlight */
    --error-color: #ff6b6b;
    /* Soft Coral Red */
    --success-color: #51cf66;
    /* Soft Mint Green */
    --shadow: 0px 10px 30px rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'DM Sans', 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    /* Default to column for public pages */
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Row layout only when sidebar is present (logged in) */
body:has(.sidebar) {
    flex-direction: row;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    color: var(--text-primary);
    height: 100vh;
    padding: 25px 20px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 100;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 30px;
    margin-bottom: 20px;
}

.sidebar-header h2 {
    font-size: 1.3rem;
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.user-profile-sidebar {
    text-align: center;
    padding: 10px 0 30px;
}

.user-avatar {
    width: 70px;
    height: 70px;
    border-radius: 20px;
    /* Modern squircle */
    background: var(--card-bg);
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--accent-color);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.user-email {
    font-size: 0.85rem;
    color: var(--text-secondary);
    word-break: break-all;
    font-weight: 500;
}

.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    opacity: 0.6;
    margin-bottom: 15px;
    padding-left: 10px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 12px 15px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.sidebar-nav a i {
    font-size: 1.25rem;
}

.sidebar-nav a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-nav a.active {
    color: white;
    background: var(--accent-color);
    box-shadow: 0 4px 15px rgba(76, 110, 245, 0.3);
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Topbar */
.topbar {
    padding: 15px 35px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 17, 26, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-box {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    width: 300px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    margin-left: 10px;
    width: 100%;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.status-badge {
    background: rgba(76, 110, 245, 0.1);
    color: var(--accent-color);
    padding: 6px 15px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.8rem;
}

.icon-button {
    background: var(--card-bg);
    border-radius: 10px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.icon-button:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* Content Area */
.content-area {
    padding: 30px;
}

.dashboard-header h1 {
    font-size: 2rem;
    margin: 0;
    font-weight: 800;
    letter-spacing: -1px;
}

.dashboard-header p {
    color: var(--text-secondary);
    margin: 8px 0 30px;
}

/* Cards */
.stat-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.03);
    transition: transform 0.3s;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    font-size: 1.4rem;
}

.stat-card h3 {
    font-size: 1.75rem;
    margin: 0;
    font-weight: 700;
}

.stat-card p {
    color: var(--text-secondary);
    margin: 5px 0 15px;
}

.stat-card a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
}

/* License Section */
.license-badge {
    padding: 6px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    background: rgba(255, 107, 107, 0.1);
    color: var(--error-color);
    display: inline-block;
}

.license-badge.active {
    background: rgba(81, 207, 102, 0.1);
    color: var(--success-color);
}

.btn-purchase {
    background: linear-gradient(135deg, #FF4B2B, #FF416C);
    color: white !important;
    padding: 14px 28px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    border: none;
}

.btn-purchase:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

/* Public Page Styles */
.public-nav {
    padding: 20px 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #161922;
    /* Solid dark background */
    position: sticky;
    top: 0;
    z-index: 2000;
    border-bottom: 3px solid var(--accent-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.public-nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    margin-left: 40px;
    transition: color 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.public-nav-links a:hover {
    color: var(--accent-color);
}

.public-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.4rem;
    font-weight: 800;
    color: white;
    text-decoration: none;
    letter-spacing: -0.5px;
}

.public-nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    margin-left: 30px;
}

.public-nav-links a:hover {
    color: white;
}

.hero-gradient {
    padding: 120px 20px;
    background: radial-gradient(circle at 50% -20%, #1c202b 0%, #0f111a 100%);
}

.feature-badge {
    background: rgba(76, 110, 245, 0.1);
    color: var(--accent-color);
    padding: 6px 15px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 25px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Muted backgrounds for icons */
.bg-purple {
    background: rgba(110, 142, 251, 0.12);
    color: #748ffc;
}

.bg-pink {
    background: rgba(255, 135, 135, 0.12);
    color: #ff8787;
}

.bg-blue {
    background: rgba(51, 154, 240, 0.12);
    color: #339af0;
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    body {
        flex-direction: column;
        overflow-y: auto;
        display: block;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        flex-direction: row;
        padding: 5px;
        background: #161922;
        z-index: 1000;
        box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.5);
    }

    .sidebar-header,
    .user-profile-sidebar,
    .nav-section-title,
    .sidebar-nav a span {
        display: none;
    }

    .sidebar-nav {
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
    }

    .sidebar-nav a {
        padding: 10px;
        border-radius: 50%;
        width: 45px;
        height: 45px;
        justify-content: center;
    }

    .sidebar-nav a i {
        font-size: 1.6rem;
    }

    .main-wrapper {
        width: 100%;
        padding-bottom: 70px;
    }

    .topbar {
        padding: 10px 15px;
        background: #0f111a;
    }

    .search-box,
    #sidebar-toggle {
        display: none;
    }

    .status-badge {
        font-size: 0.65rem;
    }

    .content-area {
        padding: 15px;
    }

    .public-nav {
        padding: 15px 10px;
        flex-direction: column;
        gap: 12px;
        background: #161922;
        /* More contrast */
        border-bottom: 3px solid var(--accent-color);
    }

    .public-nav-links {
        display: flex;
        gap: 15px;
        margin: 0;
        flex-wrap: wrap;
        justify-content: center;
    }

    .public-nav-links a {
        font-size: 0.95rem;
        /* Larger font */
        font-weight: 700;
        color: var(--text-primary) !important;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .btn-login {
        background: var(--accent-color);
        padding: 5px 15px !important;
        border-radius: 5px !important;
    }

    .hero-gradient {
        padding: 60px 15px;
    }

    .hero-gradient h1 {
        font-size: 2.5rem !important;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .license-card {
        flex-direction: column;
        text-align: center;
    }
}