@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #10b981;
    --background: #f8fafc;
    --surface: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius: 1rem;
    --transition: all 0.3s ease;
}

@media (prefers-color-scheme: dark) {
    :root {
        --background: #0f172a;
        --surface: #1e293b;
        --text: #f8fafc;
        --text-muted: #94a3b8;
        --border: #334155;
        --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
    }
    
    .form-select {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 80px; /* Space for bottom nav */
}

/* App Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar - Modern Premium Design */
.sidebar {
    width: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    border-radius: 0;
    padding: 0 1rem;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    height: 75px;
}

body.sidebar-collapsed .add-icon-circle {
    margin: 0;
}

body.sidebar-collapsed .sidebar-item.add-new-btn span {
    display: none;
}

body.sidebar-collapsed .sidebar-item.add-new-btn {
    padding: 0.5rem;
    margin: 1.5rem auto;
    border-radius: 50%;
    width: 50px;
    height: 50px;
}

body.sidebar-collapsed .add-icon-circle {
    background: transparent;
    color: white;
}

.sidebar-toggle {
    display: none;
}

/* Sidebar Custom Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.sidebar-menu {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 0;
    height: 100%;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
}
.sidebar-menu::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 0.6rem 1rem;
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    margin: 0;
    border-radius: 0.5rem;
    white-space: nowrap;
}

.sidebar-item i {
    font-size: 1.35rem;
    margin-right: 0.5rem;
    transition: transform 0.3s ease;
}

.sidebar-item:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(5px);
}
body.sidebar-collapsed .sidebar-item:hover {
    transform: none;
}

.sidebar-item:hover i {
    transform: scale(1.15);
    color: var(--secondary);
}

.sidebar-item.active {
    color: #ffffff;
    background: rgba(37, 99, 235, 0.2);
    border-bottom: 2px solid var(--primary);
    border-radius: 0.5rem 0.5rem 0 0;
    font-weight: 600;
}

.sidebar-item.active i {
    color: var(--primary);
}

.sidebar-item .item-text {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 0.5rem;
}

.sidebar-item small {
    display: none; /* Hide subtitle on horizontal bar */
}

.sidebar-divider {
    display: none;
}

.sidebar-item.add-new-btn {
    margin: 1.5rem 0.5rem;
    padding: 0.85rem 1rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 1rem;
    color: white;
    justify-content: center;
    box-shadow: 0 4px 15px -3px rgba(37, 99, 235, 0.4);
    transform: none;
    transition: all 0.3s ease;
}

.sidebar-item.add-new-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px -5px rgba(37, 99, 235, 0.6);
    background: linear-gradient(135deg, #3b82f6, #34d399);
    color: white;
}

.add-icon-circle {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 0.75rem;
}

.sidebar-item.add-new-btn i {
    margin: 0;
    font-size: 1.5rem;
    color: white;
    width: auto;
}

.sidebar-item.add-new-btn span {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: 0;
    margin-top: 75px; /* Navbar height */
    padding: 2rem;
    background-color: var(--background);
}

/* Settings Layout */
.settings-layout {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    align-items: flex-start;
}
.settings-sidebar {
    width: 250px;
    flex-shrink: 0;
    padding: 0;
}
.settings-content {
    flex: 1;
    min-width: 0;
}
.settings-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    overflow-x: visible;
    white-space: normal;
    border-bottom: none;
}
.settings-menu::-webkit-scrollbar {
    height: 4px;
}
.settings-menu::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}
.settings-menu li a {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    border-bottom: none;
    border-left: 3px solid transparent;
}
.settings-menu li a:hover {
    color: var(--primary);
    background-color: rgba(37, 99, 235, 0.05);
}
.settings-menu li a.active {
    color: var(--primary);
    background-color: rgba(37, 99, 235, 0.05);
    border-bottom: none;
    border-left: 3px solid var(--primary);
}
.settings-menu li a i {
    font-size: 1.25rem;
    margin-right: 0.5rem;
}

@media (max-width: 992px) {
    .settings-layout {
        flex-direction: column;
    }
    .settings-sidebar {
        width: 100%;
    }
    .settings-menu {
        flex-direction: row;
        overflow-x: auto;
        white-space: nowrap;
        border-bottom: 1px solid var(--border);
    }
    .settings-menu li a {
        border-left: none;
        border-bottom: 3px solid transparent;
    }
    .settings-menu li a.active {
        border-left: none;
        border-bottom: 3px solid var(--primary);
        background-color: transparent;
    }
}

.bottom-nav {
    display: none; /* Hide bottom nav by default on desktop */
}

@media (max-width: 768px) {
    .sidebar {
        display: none; /* Hide sidebar on mobile */
    }
    .main-content {
        margin-left: 0 !important;
        padding: 1rem;
    }
    .bottom-nav {
        display: flex; /* Show bottom nav on mobile */
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(var(--surface-rgb, 255, 255, 255), 0.8);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--border);
        justify-content: space-around;
        padding: 0.75rem 0;
        z-index: 1000;
    }
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item:hover, .nav-item.active {
    color: var(--primary);
    transform: translateY(-2px);
}

.nav-item i {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

/* Main Container */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Header */
header {
    margin-bottom: 2rem;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: scale(1.02);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background-color: var(--background);
    color: var(--text);
    font-family: inherit;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.form-select {
    width: 100%;
    padding: 0.75rem 2.25rem 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background-color: var(--background);
    color: var(--text);
    font-family: inherit;
    appearance: none;
    -moz-appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px 12px;
    transition: var(--transition);
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* Action Grid (for Add screen) */
.action-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: var(--transition);
}

.action-card i {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    color: var(--primary);
}

.action-card:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
    transform: translateY(-3px);
}

/* Stats */
.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}
.stat-row:last-child {
    border-bottom: none;
}
.stat-label {
    color: var(--text-muted);
}
.stat-value {
    font-weight: 600;
}
