/* wwwroot/css/app.css */

:root {
    --bg-color: #f3f4f6;
    --sidebar-bg: linear-gradient(180deg, #0f4aa3, #1f7ae0);
    --card-bg: #ffffff;
    --text-color: #22324a;
    --muted-text: #888;
    --border-color: #e5e7eb;
    --input-bg: #ffffff;
    --button-bg: #1976d2;
    --button-text: #ffffff;
}

body.dark {
    --bg-color: #0f172a;
    --sidebar-bg: linear-gradient(180deg, #0b1220, #162033);
    --card-bg: #1e293b;
    --text-color: #f1f5f9;
    --muted-text: #cbd5e1;
    --border-color: #334155;
    --input-bg: #0f172a;
    --button-bg: #2563eb;
    --button-text: #ffffff;
}

:root {
    /* --- Default (Light Mode) Variables --- */
    --nexus-bg: #f4f7fa;         /* Main page background */
    --nexus-text: #333333;       /* Main text color */
    --card-bg: #ffffff;          /* Card background */
    --card-border: #e0e0e0;      /* Card border */
    --input-bg: #ffffff;         /* Inputs/Textareas */
    --input-border: #e0e0e0;     /* Input borders */
    /* You already have --nexus-blue defined somewhere, keep that! */
}

/* IMPORTANT: Tell the body to actually USE these variables */
body {
    background-color: var(--nexus-bg);
    color: var(--nexus-text);
    transition: background-color 0.3s ease, color 0.3s ease;
    margin: 0;
}

:root {
    /* The NoteNexus Color Palette */
    --nexus-blue: #1976d2;       /* Primary Action Color */
    --nexus-dark-blue: #0d47a1;  /* Sidebar Gradient Start */
    --nexus-light-blue: #2196f3; /* Sidebar Gradient End */
    --nexus-bg: #f0f2f5;         /* Light Grey Background */
    --nexus-text: #2c3e50;       /* Dark Text */
    --nexus-danger: #ef5350;     /* Delete Red */
    --card-radius: 12px;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

body {
    background-color: var(--nexus-bg);
    font-family: 'Segoe UI', 'Roboto', Helvetica, Arial, sans-serif;
    color: var(--nexus-text);
}

/* --- SIDEBAR STYLING --- */
.sidebar {
    background-image: linear-gradient(180deg, var(--nexus-light-blue) 0%, var(--nexus-dark-blue) 100%);
    box-shadow: 4px 0 10px rgba(0,0,0,0.1);
}

.sidebar .nav-item a {
    color: rgba(255, 255, 255, 0.8) !important;
    border-radius: 8px;
    margin: 4px 12px;
    transition: all 0.2s ease;
}

.sidebar .nav-item a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white !important;
}

.sidebar .nav-item a.active {
    background-color: rgba(255, 255, 255, 0.25) !important;
    color: white !important;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.top-row.navbar {
    background-color: rgba(0,0,0,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.navbar-brand {
    font-weight: bold;
    letter-spacing: 0.5px;
}

/* --- MAIN CONTENT CARDS --- */
.nexus-card {
    background-color: var(--card-bg);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 24px;
    border: 1px solid var(--card-border);
    transition: transform 0.2s, background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    color: var(--nexus-text);
}

/* Inputs */
input[type="text"], textarea {
    background-color: var(--input-bg);
    color: var(--nexus-text);
    border: 2px solid var(--input-border);
    border-radius: 8px;
    padding: 12px;
    transition: border-color 0.2s, background-color 0.3s ease, color 0.3s ease;
}

input[type="text"]:focus, textarea:focus {
    border-color: var(--nexus-blue);
    outline: none;
}

/* Buttons */
.btn-primary {
    background-color: var(--nexus-blue);
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(25, 118, 210, 0.3);
    color: white;
}

.btn-primary:hover {
    background-color: var(--nexus-dark-blue);
}

.btn-delete {
    color: var(--nexus-danger);
    background: #ffebee;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-delete:hover {
    background: #ffcdd2;
}

/* List Items */
.todo-item {
    background: var(--card-bg);
    border-bottom: 1px solid var(--card-border);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--nexus-text);
}

.todo-item:last-child {
    border-bottom: none;
}

/* 1. The Container for the whole page */
.page {
    display: flex;
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
}

/* 2. The Sidebar (Force it to the left) */
.sidebar {
    width: 250px;
    height: 100vh;
    background-image: linear-gradient(180deg, var(--nexus-dark-blue) 0%, var(--nexus-blue) 100%);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

/* 3. The Main Content Area (Take remaining space) */
main {
    flex: 1;
    overflow-y: auto;
    background-color: var(--nexus-bg);
    padding: 0;
    color: var(--nexus-text);
}

/* 4. Fix the Navigation Links spacing */
.nav-scrollable {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding-top: 20px;
}

.nav-item {
    font-size: 1.1rem;
    margin-bottom: 5px;
}

/* Hide the hamburger menu on Desktop (we want a permanent sidebar) */
.navbar-toggler {
    display: none;
}

/* Make the top brand header look nice */
.top-row.navbar {
    height: 3.5rem;
    background-color: rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    padding-left: 1.5rem;
}

.navbar-brand {
    color: white !important;
    font-size: 1.2rem;
    font-weight: bold;
    text-decoration: none;
}

/* Delete icon */
button[title="Delete Task"]:hover {
    background-color: #d31919 !important;
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    .page {
        flex-direction: column;
        color: var(--nexus-text);
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .navbar-toggler {
        display: block;
        border: 1px solid rgba(255,255,255,0.5);
        padding: 5px 10px;
        border-radius: 4px;
        background: transparent;
        cursor: pointer;
    }

    .navbar-toggler-icon {
        display: inline-block;
        width: 1.5em;
        height: 1.5em;
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255, 255, 255, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: center;
        background-size: 100%;
    }

    main {
        height: calc(100vh - 60px);
    }
}

/* --- DESKTOP NAVIGATION FIX --- */
@media (min-width: 769px) {
    .nav-scrollable.collapse {
        display: block !important;
        height: 100% !important;
    }

    .nav-scrollable {
        display: block !important;
    }
}

/* --- NOTEPAD MOBILE LOGIC --- */

/* Desktop Default (Keep side-by-side) */
.notepad-list { width: 300px; display: flex; }
.notepad-editor { flex: 1; display: flex; }

/* Mobile Overrides */
@media (max-width: 768px) {
    .notepad-layout .notepad-list { 
        width: 100% !important; 
        display: flex !important; 
    }
    
    .notepad-layout .notepad-editor { 
        display: none !important; 
    }

    .notepad-layout.mobile-editing .notepad-list { 
        display: none !important; 
    }
    
    .notepad-layout.mobile-editing .notepad-editor { 
        display: flex !important; 
        width: 100% !important; 
    }
    
    .notepad-layout {
        height: calc(100vh - 60px) !important;
    }
}

/* --- SIDEBAR LOGO --- */
.logo-container {
    padding: 0 !important;
    display: flex;
    align-items: center;
    height: 100%;
}

.sidebar-logo {
    height: 40px; 
    width: auto;
    margin-left: 10px; 
}

/* --- REUSABLE DELETE COMPONENT --- */
.nexus-delete-btn {
    background-color: #ffebee;
    color: #d32f2f;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.nexus-delete-btn:hover {
    background-color: #ffcdd2;
    transform: translateY(-1px);
}

.nexus-delete-btn:active {
    transform: translateY(1px);
}

/* --- Dark Mode Overrides --- */
body.dark {
    --nexus-bg: #121212;
    --nexus-text: #e0e0e0;
    --card-bg: #1e1e1e;
    --card-border: #333333;
    --input-bg: #2d2d2d;
    --input-border: #444444;
    --nexus-blue: #64b5f6;
}

/* --- Ensure Components Use the Variables --- */
.nexus-card {
    background-color: var(--card-bg) !important;
    border-color: var(--card-border) !important;
    color: var(--nexus-text) !important;
    transition: all 0.3s ease;
}

input, textarea, select {
    background-color: var(--input-bg) !important;
    color: var(--nexus-text) !important;
    border-color: var(--input-border) !important;
    transition: all 0.3s ease;
}

body.dark .nexus-delete-btn {
    background-color: #4a2c2c;
    color: #ff8a80;
}

body.dark .nexus-delete-btn:hover {
    background-color: #5c3a3a;
}

/* --- MOBILE LAYOUT FIXES --- */
@media (max-width: 768px) {
    .page {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .sidebar {
        width: 100%;
        height: auto;
        min-height: 70px;
        position: relative;
    }

    main {
        width: 100%;
        height: auto;
        overflow: visible;
    }

    .content {
        padding: 12px !important;
    }

    .top-bar {
        padding: 10px 12px !important;
        flex-wrap: wrap;
        gap: 8px;
    }

    .breadcrumbs {
        font-size: 0.85rem;
    }

    .nexus-card {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 16px;
        border-radius: 10px;
        box-sizing: border-box;
    }

    input[type="text"],
    textarea,
    select {
        width: 100%;
        box-sizing: border-box;
    }

    .btn-primary,
    .nexus-delete-btn,
    button {
        max-width: 100%;
    }

    .todo-item {
        gap: 10px;
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .nav-scrollable {
        padding-top: 10px;
    }

    .nav-item {
        margin-bottom: 2px;
    }

    .sidebar .nav-item a {
        margin: 2px 8px;
        padding: 10px 12px;
        font-size: 0.95rem;
    }

    .top-row.navbar {
        height: auto;
        min-height: 60px;
        padding: 10px 14px;
    }

    .sidebar-logo {
        height: 30px;
    }
}

.bi {
    margin-right: 8px;
}

.bi {
    margin-right: 8px;
}

/* Mobile nav collapse behavior */
@media (max-width: 768px) {
    .navbar-toggler {
        display: block;
        border: 1px solid rgba(255,255,255,0.5);
        padding: 5px 10px;
        border-radius: 4px;
        background: transparent;
        cursor: pointer;
    }

    .navbar-toggler-icon {
        display: inline-block;
        width: 1.5em;
        height: 1.5em;
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255, 255, 255, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: center;
        background-size: 100%;
    }

    .nav-scrollable.collapse {
        display: none;
    }

    .nav-scrollable {
        display: block;
        width: 100%;
        background: inherit;
    }
}

/* Desktop: always show menu */
@media (min-width: 769px) {
    .navbar-toggler {
        display: none;
    }

    .nav-scrollable {
        display: block !important;
        height: 100%;
    }

    .nav-scrollable.collapse {
        display: block !important;
    }
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}
/* --- SPLASH SCREEN STYLES --- */
.splash-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
    background: linear-gradient(135deg, #0d47a1 0%, #1976d2 100%);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
}

.splash-content {
    text-align: center;
    color: white;
    animation: fadeIn 1s ease-out;
}

.splash-logo {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: 2px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.splash-icon-pulse {
    font-size: 3.5rem;
    color: #4fc3f7;
    animation: pulse 2s infinite ease-in-out;
}

.splash-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto 20px;
}

.splash-text {
    font-size: 1.1rem;
    font-weight: 500;
    opacity: 0.9;
    letter-spacing: 1px;
    animation: pulseText 2s infinite ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseText {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

body.dark .splash-container {
    background: linear-gradient(135deg, #0b1220 0%, #162033 100%);
}

.auth-logo-img {
    height: 35px;
    width: auto;
}

.splash-logo-img {
    height: 70px;
    width: auto;
}

/* --- COMPOSITE BRAND LOGO --- */
.brand-composite {
    display: flex;
    align-items: center;
}
.brand-composite-img {
    width: auto;
}
.brand-composite-text-block {
    display: flex;
    flex-direction: column;
    text-align: left;
}
.brand-composite-title {
    font-weight: 900;
    line-height: 1;
    color: inherit;
}
.brand-composite-line {
    background-color: #4fc3f7;
    width: 100%;
}
.brand-composite-subtitle {
    font-weight: 500;
    opacity: 0.85;
}

/* Size: Splash Screen */
.brand-splash { gap: 20px; color: white; }
.brand-splash .brand-composite-img { height: 180px; }
.brand-splash .brand-composite-title { font-size: 7rem; letter-spacing: 4px; }
.brand-splash .brand-composite-line { height: 6px; margin: 12px 0; border-radius: 4px; }
.brand-splash .brand-composite-subtitle { font-size: 2rem; letter-spacing: 2px; }

/* Size: Auth Pages */
.brand-auth { gap: 12px; color: var(--nexus-text); }
.brand-auth .brand-composite-img { height: 45px; }
.brand-auth .brand-composite-title { font-size: 1.8rem; letter-spacing: 1px; }
.brand-auth .brand-composite-line { height: 3px; margin: 4px 0; border-radius: 2px; }
.brand-auth .brand-composite-subtitle { font-size: 0.75rem; letter-spacing: 0.5px; }

/* Size: Sidebar */
.brand-sidebar { gap: 10px; color: white; padding-left: 5px; }
.brand-sidebar .brand-composite-img { height: 35px; }
.brand-sidebar .brand-composite-title { font-size: 1.3rem; letter-spacing: 0.5px; }
.brand-sidebar .brand-composite-line { height: 2px; margin: 3px 0; border-radius: 2px; }
.brand-sidebar .brand-composite-subtitle { font-size: 0.55rem; letter-spacing: 0.5px; opacity: 0.7; }

/* --- COMPOSITE BRAND LOGO MOBILE FIXES --- */
@media (max-width: 768px) {
    /* Splash Screen Mobile Adjustments */
    .brand-splash { gap: 15px; flex-direction: column; text-align: center; }
    .brand-splash .brand-composite-text-block { align-items: center; text-align: center; }
    .brand-splash .brand-composite-img { height: 90px; }
    .brand-splash .brand-composite-title { font-size: 2.8rem; letter-spacing: 1px; }
    .brand-splash .brand-composite-line { height: 4px; margin: 6px 0; width: 60%; }
    .brand-splash .brand-composite-subtitle { font-size: 0.9rem; letter-spacing: 1px; }

    /* Auth Pages Mobile Adjustments */
    .brand-auth { gap: 10px; }
    .brand-auth .brand-composite-img { height: 35px; }
    .brand-auth .brand-composite-title { font-size: 1.4rem; letter-spacing: 0.5px; }
    .brand-auth .brand-composite-line { height: 2px; margin: 3px 0; }
    .brand-auth .brand-composite-subtitle { font-size: 0.6rem; letter-spacing: 0.2px; }

    /* Sidebar Mobile Adjustments */
    .brand-sidebar { gap: 8px; padding-left: 0; }
    .brand-sidebar .brand-composite-img { height: 28px; }
    .brand-sidebar .brand-composite-title { font-size: 1.2rem; letter-spacing: 0.5px; }
    .brand-sidebar .brand-composite-line { height: 2px; margin: 2px 0; }
    .brand-sidebar .brand-composite-subtitle { font-size: 0.55rem; letter-spacing: 0.2px; }

    /* Layout fixes */
    .top-row.navbar {
        justify-content: center;
        width: 100%;
        box-sizing: border-box;
        position: relative;
    }
    .navbar-toggler {
        position: absolute;
        right: 14px;
    }
}
