/* NoteSpace Modern CSS Design System */

:root {
    --transition-speed: 0.25s;
    --border-radius: 12px;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    
    /* Light Mode Variables */
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-sidebar: #1e293b;
    --sidebar-text: #e2e8f0;
    --sidebar-text-hover: #ffffff;
    --sidebar-active: #3b82f6;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border-color: #e2e8f0;
    --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --input-bg: #ffffff;
    --input-border: #cbd5e1;
}

[data-theme="dark"] {
    /* Dark Mode Variables */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-sidebar: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-text-hover: #f1f5f9;
    --sidebar-active: #3b82f6;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --card-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
    --input-bg: #0f172a;
    --input-border: #334155;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Outfit', 'Inter', -apple-system, sans-serif;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    overflow-x: hidden;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background-color: var(--bg-sidebar);
    color: var(--sidebar-text);
    z-index: 1000;
    transition: width var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.sidebar .brand {
    padding: 1.5rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    white-space: nowrap;
}

.sidebar .brand-name {
    font-weight: 700;
    font-size: 1.25rem;
    color: #fff;
    letter-spacing: 0.5px;
    transition: opacity var(--transition-speed);
}

.sidebar-nav {
    list-style: none;
    padding: 1rem 0.75rem;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 0.25rem;
    transition: all var(--transition-speed);
    white-space: nowrap;
    overflow: hidden;
}

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

.sidebar-nav-item.active a {
    background-color: var(--sidebar-active);
    color: #ffffff;
    font-weight: 500;
}

.sidebar-nav-item i {
    font-size: 1.25rem;
    min-width: 24px;
    display: flex;
    justify-content: center;
}

/* Sidebar Collapsed State */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .brand-name,
.sidebar.collapsed .nav-text {
    opacity: 0;
    pointer-events: none;
    width: 0;
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* Main Content Wrapper */
.main-content {
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.navbar-top {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color var(--transition-speed);
}

.content-body {
    flex-grow: 1;
    padding: 2rem;
}

/* Premium Card Styling */
.card-premium {
    cursor: pointer;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    transition: background-color var(--transition-speed), border-color var(--transition-speed), transform 0.2s;
}

.card-premium:hover {
    transform: translateY(-2px);
}

/* Sticky Notes Widgets */
.sticky-container {
    position: relative;
    min-height: 400px;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    background-color: rgba(0, 0, 0, 0.02);
    padding: 15px;
}

.sticky-note-card {
    position: absolute;
    width: 250px;
    height: 250px;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    cursor: move;
    transition: box-shadow 0.2s, transform 0.2s;
    user-select: none;
    z-index: 10;
}

.sticky-note-card:active {
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
    transform: scale(1.02);
    z-index: 100;
}

.sticky-note-card .sticky-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding-bottom: 5px;
}

.sticky-note-card .sticky-title {
    font-weight: 600;
    font-size: 1rem;
    margin: 0;
    border: none;
    background: transparent;
    width: 80%;
}

.sticky-note-card .sticky-body {
    flex-grow: 1;
    border: none;
    background: transparent;
    resize: none;
    font-size: 0.9rem;
    line-height: 1.4;
    outline: none;
}

/* Sticky Note Colors (Warm Palette) */
.sticky-yellow { background-color: #fef08a; color: #854d0e; }
.sticky-blue { background-color: #bfdbfe; color: #1e40af; }
.sticky-green { background-color: #bbf7d0; color: #166534; }
.sticky-pink { background-color: #fbcfe8; color: #9d174d; }
.sticky-purple { background-color: #e9d5ff; color: #6b21a8; }
.sticky-orange { background-color: #fed7aa; color: #9a3412; }

/* Sticky resize handle override */
.sticky-note-card .resizer {
    width: 15px;
    height: 15px;
    background: rgba(0,0,0,0.1);
    position: absolute;
    right: 0;
    bottom: 0;
    cursor: se-resize;
    border-radius: 0 0 12px 0;
}

/* Form Styling */
.form-control, .form-select {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 0.6rem 1rem;
}

.form-control:focus, .form-select:focus {
    background-color: var(--input-bg);
    color: var(--text-primary);
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Editors Support styling */
.editor-container {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--bg-secondary);
    min-height: 500px;
    display: flex;
    flex-direction: column;
}

.editor-toolbar {
    padding: 10px 15px;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.editor-toolbar button {
    border-radius: 6px;
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.editor-textarea-wrapper {
    flex-grow: 1;
    position: relative;
}

.editor-textarea {
    width: 100%;
    height: 500px;
    border: none;
    outline: none;
    padding: 20px;
    background-color: transparent;
    color: var(--text-primary);
    resize: none;
    font-size: 1.05rem;
    font-family: inherit;
}

.editor-code-textarea {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Focus Mode */
.focus-mode-active {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    background-color: var(--bg-secondary);
    border-radius: 0;
    margin: 0;
}

.focus-mode-active .editor-textarea {
    height: calc(100vh - 60px);
}

/* Splits for Markdown preview */
.markdown-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background-color: var(--border-color);
}

.markdown-preview-panel {
    background-color: var(--bg-secondary);
    padding: 20px;
    overflow-y: auto;
    height: 500px;
}

/* Keyboard Shortcut Help banner */
.shortcut-badge {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Custom list items for Checklists */
.checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.checklist-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    cursor: pointer;
}

/* Calendar styling */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}

.calendar-cell {
    min-height: 100px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    position: relative;
    transition: all 0.2s;
}

.calendar-cell:hover {
    border-color: #3b82f6;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.1);
}

.calendar-cell .cell-date {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.calendar-cell .cell-events {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 70px;
    overflow-y: auto;
}

.calendar-event-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    cursor: pointer;
}

/* Responsive Overrides */
@media (max-width: 991.98px) {
    .sidebar {
        left: -260px;
    }
    
    .sidebar.mobile-show {
        left: 0;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .sidebar.collapsed ~ .main-content {
        margin-left: 0;
    }

    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 990;
        transition: opacity var(--transition-speed);
    }
}

@media (max-width: 767.98px) {
    .sticky-container {
        display: flex;
        flex-direction: column;
        gap: 15px;
        min-height: auto !important;
        background: transparent;
        border: none;
        padding: 0;
    }
    .sticky-note-card {
        position: static !important;
        width: 100% !important;
        height: auto !important;
        min-height: 200px;
    }
}
