:root {
    --bg-body: #f0f9ff;
    /* Very light blue */
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #3b82f6;
    /* Blue 500 */
    --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --sidebar-width: 240px;
    /* Slightly narrower */
    --card-bg: rgba(255, 255, 255, 0.75);
    --card-border: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 4px 20px 0 rgba(59, 130, 246, 0.05);
    /* Blue-ish shadow */
    --radius: 20px;
    /* Slightly less rounded */
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', 'Inter', sans-serif;
    background-color: #f0f9ff;
    /* Blue Mesh Gradient */
    background-image:
        radial-gradient(at 0% 0%, hsla(217, 91%, 91%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(210, 100%, 96%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(199, 89%, 92%, 1) 0, transparent 50%);
    background-size: 100% 100%;
    /* Static background is cleaner/more compact */
    color: var(--text-main);
    margin: 0;
    padding: 0;
    display: flex;
    min-height: 100vh;
}

@keyframes gradient-animation {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Layout */
/* .app-container {
    display: flex;
    height: 100vh;
} */

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    padding: 2rem 1.2rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.brand {
    font-size: 1.4rem;
    font-weight: 700;
    /* Lighter bold */
    color: #1e3a8a;
    /* Dark Blue */
    margin-bottom: 2.5rem;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: none;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    /* Tighter gap */
    flex: 1;
}

.nav-item {
    padding: 0.7rem 1rem;
    /* Smaller padding */
    border-radius: 12px;
    color: #475569;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border: 1px solid transparent;
    font-size: 0.95rem;
}

.nav-item:hover {
    background: rgba(59, 130, 246, 0.08);
    color: var(--primary);
    transform: translateX(2px);
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.12);
    color: var(--primary);
    font-weight: 600;
    border: 1px solid rgba(59, 130, 246, 0.1);
    box-shadow: none;
}

.user-profile {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 2rem;
    /* Reduced padding */
    max-width: 1600px;
}

.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    /* Reduced margin */
}

.page-title {
    font-size: 1.6rem;
    /* Smaller title */
    font-weight: 600;
    /* Lighter weight */
    margin: 0;
    letter-spacing: -0.5px;
    color: #1e293b;
    text-shadow: none;
}

/* Grid & Cards */
.grid {
    display: grid;
    gap: 1rem;
    /* Tighter grid gap */
    margin-bottom: 1.5rem;
}

.card {
    background: rgba(255, 255, 255, 0.6);
    /* More transparent */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius);
    padding: 1rem;
    /* Compact padding */
    box-shadow: var(--glass-shadow);
    border: 1px solid rgba(255, 255, 255, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    overflow: hidden;
    /* Prevent content from expanding card */
}

canvas {
    max-width: 100%;
}

.card h3 {
    margin: 0 0 0.8rem 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.2px;
}

/* Form Compactness */
.form-group {
    margin-bottom: 0.8rem;
    /* Tighter form spacing */
}

label {
    display: block;
    margin-bottom: 0.2rem;
    color: #64748b;
    font-weight: 500;
    font-size: 0.8rem;
}

input,
select,
textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    /* Compact padding */
    font-size: 0.9rem;
    transition: all 0.2s;
    color: #1e293b;
    font-family: inherit;
}

input[type="range"] {
    margin: 0;
    /* Remove default margins */
    display: block;
    width: 100%;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    /* Compact button */
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
    background: #2563eb;
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-outline {
    background: transparent;
    border: 1px solid #cbd5e1;
    color: #475569;
    box-shadow: none;
}

.btn-outline:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.btn-danger {
    background-color: #fee2e2;
    color: var(--danger);
}

.btn-danger:hover {
    background-color: #fecaca;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.4rem;
    color: #64748b;
    font-weight: 500;
    font-size: 0.85rem;
}

input,
select,
textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    /* Compact padding */
    font-size: 0.9rem;
    transition: all 0.2s;
    color: #1e293b;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

th {
    text-align: left;
    padding: 1rem;
    color: #64748b;
    font-weight: 700;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

td {
    padding: 1.2rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    color: #334155;
    font-size: 0.95rem;
}

tr:last-child td {
    border-bottom: none;
}

/* Progress Bar */
#progressBarContainer {
    width: 100%;
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 4px;
    margin-top: 1.5rem;
    overflow: hidden;
    display: none;
}

#progressBar {
    width: 0%;
    height: 100%;
    background-color: var(--primary);
    transition: width 0.5s ease;
    border-radius: 4px;
}

#progressText {
    text-align: center;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

#syncLog {
    background: #1f2937;
    color: #10b981;
    padding: 1rem;
    border-radius: 8px;
    font-family: 'Fira Code', monospace;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 1rem;
    display: none;
    font-size: 0.8rem;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Utilities */
.text-success {
    color: var(--success);
}

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

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

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

/* Masonry Grid Layout */
.masonry-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.masonry-col {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Responsive Breakpoints */
@media (max-width: 1200px) {
    .masonry-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .masonry-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        position: fixed;
        z-index: 100;
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
}