:root {
    --primary-color: #2eb872; /* Emerald Green */
    --secondary-color: #1a1a1a; /* Dark */
    --text-light: #f5f5f5;
    --text-dark: #333;
    --bg-light: #fafafa;
    --bg-dark: #0a140f; /* Dark Green Tint */
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    line-height: 1.6;
}

/* Typography */
h1, h2, h3 {
    font-weight: 700;
    letter-spacing: -0.5px;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: all 0.3s ease;
}

a:hover {
    color: #fff;
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.text-center {
    text-align: center;
}

.mt-2 { margin-top: 2rem; }
.mb-2 { margin-bottom: 2rem; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 30px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #1f8a53);
    color: var(--bg-dark);
    box-shadow: 0 4px 15px rgba(46, 184, 114, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 184, 114, 0.4);
    color: var(--bg-dark);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: var(--bg-dark);
}

/* Navbar */
.navbar {
    padding: 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo {
    font-size: 24px;
    font-weight: 800;
    color: #d4af37; /* Golden */
    letter-spacing: 2px;
    text-transform: uppercase;
}

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 24px;
    cursor: pointer;
}

/* Hero Section */
.hero {
    height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.hero-content {
    max-width: 600px;
    z-index: 2;
    position: relative;
}

.hero-title {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 20px;
    background: linear-gradient(to right, #fff, var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: #aaa;
    margin-bottom: 30px;
}

.hero-image {
    position: absolute;
    right: 5%;
    top: 50%;
    transform: translateY(-50%);
    width: 50%;
    max-width: 600px;
    z-index: 1;
    opacity: 0.8;
    filter: drop-shadow(0 0 40px rgba(46, 184, 114, 0.2));
}

/* Glassmorphism Forms */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 80px);
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 40px;
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #ccc;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(0, 0, 0, 0.4);
}

.form-control::placeholder {
    color: #666;
}

/* Dashboard Layout */
.dashboard-wrap {
    display: flex;
    min-height: calc(100vh - 80px);
}

.sidebar {
    width: 250px;
    background: rgba(255, 255, 255, 0.02);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    padding: 30px 20px;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 15px;
}

.sidebar-menu a {
    display: block;
    padding: 10px 15px;
    border-radius: 8px;
    color: #aaa;
}

.sidebar-menu a:hover, .sidebar-menu a.active {
    background: rgba(46, 184, 114, 0.1);
    color: var(--primary-color);
}

.main-content {
    flex: 1;
    padding: 30px;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 12px;
}

.stat-title {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Binary Tree Visualization */
.tree-container {
    overflow-x: auto;
    padding: 20px 0;
    text-align: center;
}

.tree {
    display: inline-block;
    min-width: max-content;
}

.tree ul {
    padding-top: 20px; position: relative;
    transition: all 0.5s;
    -webkit-transition: all 0.5s;
    -moz-transition: all 0.5s;
    display: flex;
    justify-content: center;
}

.tree li {
    float: left; text-align: center;
    list-style-type: none;
    position: relative;
    padding: 20px 5px 0 5px;
    transition: all 0.5s;
    -webkit-transition: all 0.5s;
    -moz-transition: all 0.5s;
}

/*We will use ::before and ::after to draw the connectors*/
.tree li::before, .tree li::after{
    content: '';
    position: absolute; top: 0; right: 50%;
    border-top: 1px solid #ccc;
    width: 50%; height: 20px;
}
.tree li::after{
    right: auto; left: 50%;
    border-left: 1px solid #ccc;
}

/*We need to remove left-right connectors from elements without any siblings*/
.tree li:only-child::after, .tree li:only-child::before {
    display: none;
}

/*Remove space from the top of single children*/
.tree li:only-child{ padding-top: 0;}

/*Remove left connector from first child and right connector from last child*/
.tree li:first-child::before, .tree li:last-child::after{
    border: 0 none;
}
/*Adding back the vertical connector to the last nodes*/
.tree li:last-child::before{
    border-right: 1px solid #ccc;
    border-radius: 0 5px 0 0;
}
.tree li:first-child::after{
    border-radius: 5px 0 0 0;
}

/*Time to add downward connectors from parents*/
.tree ul ul::before{
    content: '';
    position: absolute; top: 0; left: 50%;
    border-left: 1px solid #ccc;
    width: 0; height: 20px;
}

.tree li a {
    border: 1px solid var(--glass-border);
    padding: 15px 20px;
    text-decoration: none;
    color: var(--text-light);
    font-family: arial, verdana, tahoma;
    font-size: 12px;
    display: inline-block;
    border-radius: 8px;
    background: var(--glass-bg);
    transition: all 0.5s;
    min-width: 100px;
}

.tree li a:hover, .tree li a:hover+ul li a {
    background: rgba(46, 184, 114, 0.2);
    color: #fff;
    border-color: var(--primary-color);
}

.node-empty {
    border: 1px dashed #666 !important;
    background: transparent !important;
    color: #666 !important;
}

.node-icon {
    font-size: 24px;
    margin-bottom: 5px;
    display: block;
    color: var(--primary-color);
}
.node-empty .node-icon {
    color: #666;
}

.node-left {
    border-color: #3b82f6 !important;
    background: rgba(59, 130, 246, 0.1) !important;
}
.node-left .node-icon, .node-empty.node-left {
    color: #3b82f6 !important;
}
.node-empty.node-left {
    border: 1px dashed #3b82f6 !important;
    background: transparent !important;
}

.node-right {
    border-color: #a855f7 !important;
    background: rgba(168, 85, 247, 0.1) !important;
}
.node-right .node-icon, .node-empty.node-right {
    color: #a855f7 !important;
}
.node-empty.node-right {
    border: 1px dashed #a855f7 !important;
    background: transparent !important;
}

.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}
.alert-error {
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    color: #ff6b6b;
}
.alert-success {
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid rgba(0, 255, 0, 0.3);
    color: #51cf66;
}

/* Responsive */
@media (max-width: 768px) {
    .hero {
        flex-direction: column;
        justify-content: center;
        text-align: center;
    }
    .hero-image {
        position: relative;
        right: 0;
        top: 0;
        transform: none;
        width: 80%;
        margin-top: 40px;
    }
    .hero-title {
        font-size: 2.5rem;
    }
    .dashboard-wrap {
        flex-direction: column;
    }
    .menu-toggle {
        display: block;
    }
    .nav-links {
        display: none; /* Hidden by default on mobile, shown via sidebar on dashboard */
    }
    /* For public pages like index, login, register where there is no sidebar */
    .public-navbar {
        flex-direction: column;
    }
    .public-navbar .menu-toggle {
        display: none;
    }
    .public-navbar .nav-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        width: 100%;
        margin-top: 10px;
    }
    .sidebar {
        display: none;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    .sidebar.active {
        display: block;
    }
    .mobile-only {
        display: block !important;
    }
}

.mobile-only {
    display: none;
}
