@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-dark: #07050f;
    --bg-card: rgba(18, 14, 33, 0.6);
    --bg-card-hover: rgba(30, 24, 54, 0.7);
    --border-color: rgba(255, 255, 255, 0.07);
    --border-color-active: rgba(124, 58, 237, 0.5);
    
    --primary: #7c3aed;
    --primary-hover: #9061f9;
    --primary-glow: rgba(124, 58, 237, 0.3);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(124, 58, 237, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.05) 0%, transparent 40%);
    background-attachment: fixed;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
    background: rgba(124, 58, 237, 0.3);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(124, 58, 237, 0.6);
}

/* Glass panel utility */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

/* Auth Container */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 40px;
    animation: fadeIn 0.6s ease-out;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: rgba(0, 0, 0, 0.35);
}

.error-msg {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 6px;
    display: block;
    animation: slideIn 0.3s ease-out;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    width: 100%;
    margin-top: 10px;
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: none;
}

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

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary-hover);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 320px;
    min-width: 300px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    background: rgba(12, 9, 23, 0.5);
    backdrop-filter: blur(20px);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.logo-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.logo-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding-left: 36px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.notes-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.note-item {
    display: block;
    padding: 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    text-decoration: none;
    margin-bottom: 12px;
    transition: var(--transition);
    cursor: pointer;
}

.note-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.note-item.active {
    background: rgba(124, 58, 237, 0.15);
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.1);
}

.note-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-preview {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.note-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.note-author {
    font-weight: 500;
    color: rgba(124, 58, 237, 0.7);
}

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 0.9rem;
}

.user-info-name {
    font-size: 0.9rem;
    font-weight: 500;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.btn-logout:hover {
    color: var(--danger);
}

/* Editor Main Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: transparent;
}

/* Blank State */
.blank-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 40px;
    text-align: center;
}

.blank-icon {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    opacity: 0.5;
}

.blank-state h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.blank-state p {
    color: var(--text-secondary);
    max-width: 360px;
    margin-bottom: 24px;
    font-size: 0.95rem;
}

/* Active Editor Layout */
.editor-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
}

.editor-header {
    padding: 20px 40px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(12, 9, 23, 0.2);
}

.note-title-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1.8rem;
    font-weight: 700;
    width: 100%;
    max-width: 60%;
}

.note-title-input::placeholder {
    color: var(--text-muted);
}

.editor-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.editor-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-icon {
    font-size: 1rem;
}

.btn-primary-action {
    background: var(--primary);
    color: white;
    border: none;
}

.btn-primary-action:hover {
    background: var(--primary-hover);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.editor-body {
    flex: 1;
    position: relative;
    padding: 40px;
    background: rgba(0, 0, 0, 0.15);
}

.note-textarea {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1.1rem;
    line-height: 1.6;
}

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

/* Modals & Dialogs */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    width: 100%;
    max-width: 460px;
    padding: 32px;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.open .modal-card {
    transform: scale(1);
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.modal-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 24px;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-buttons button, .modal-buttons a {
    width: auto;
    margin-top: 0;
}

/* Autosave and Status Messages */
.save-status {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.save-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid transparent;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

.save-status.saving .save-spinner {
    display: inline-block;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* Mobile responsive drawer toggle (if needed) */
@media(max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: 350px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    .editor-header {
        padding: 16px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .note-title-input {
        max-width: 100%;
    }
    .editor-body {
        padding: 20px;
    }
}
