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

:root {
    /* Modern Color Palette (Tailwind-inspired) */
    --primary-color: #6366f1; /* Indigo 500 */
    --primary-hover: #4f46e5; /* Indigo 600 */
    --primary-light: #e0e7ff; /* Indigo 100 */
    
    --secondary-color: #64748b; /* Slate 500 */
    --secondary-hover: #475569; /* Slate 600 */
    
    --accent-color: #8b5cf6; /* Violet 500 */
    
    /* Backgrounds */
    --bg-body: #f8fafc; /* Slate 50 */
    --bg-surface: #ffffff;
    --bg-sidebar: #ffffff;
    
    /* Text */
    --text-main: #0f172a; /* Slate 900 */
    --text-muted: #64748b; /* Slate 500 */
    --text-light: #94a3b8; /* Slate 400 */
    
    /* States */
    --success-bg: #dcfce7; /* Green 100 */
    --success-text: #166534; /* Green 800 */
    --error-bg: #fee2e2; /* Red 100 */
    --error-text: #991b1b; /* Red 800 */
    
    /* Borders & Shadows */
    --border-color: #e2e8f0; /* Slate 200 */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* Typography */
    --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-main);
    font-weight: 600;
    letter-spacing: -0.025em;
    margin-bottom: 0.75rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p { margin-bottom: 1rem; color: var(--text-muted); }

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* Layout */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Utility Classes */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-grow { flex-grow: 1; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.align-center { align-items: center; }
.align-start { align-items: flex-start; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-light { color: var(--text-light); }
.text-primary { color: var(--primary-color); }
.font-medium { font-weight: 500; }
.font-bold { font-weight: 600; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.h-screen { height: 100vh; }

/* Spacing */
.gap-xs { gap: 0.25rem; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }
.gap-lg { gap: 1.5rem; }
.gap-xl { gap: 2rem; }

.m-0 { margin: 0; }
.mt-auto { margin-top: auto; }
.mr-auto { margin-right: auto; }
.mb-sm { margin-bottom: 0.5rem; }
.mb-md { margin-bottom: 1rem; }
.mb-lg { margin-bottom: 1.5rem; }
.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 1rem; }
.mt-lg { margin-top: 1.5rem; }
.mt-xl { margin-top: 2rem; }
.pt-md { padding-top: 1rem; }
.pb-md { padding-bottom: 1rem; }
.p-md { padding: 1rem; }
.p-lg { padding: 1.5rem; }
.p-xl { padding: 2rem; }

.border-top { border-top: 1px solid var(--border-color); }
.border-bottom { border-bottom: 1px solid var(--border-color); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.bg-body { background-color: var(--bg-body); }
.bg-surface { background-color: var(--bg-surface); }

.hidden { display: none; }
.block { display: block; }
.relative { position: relative; }
.absolute { position: absolute; }

/* Components */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: white;
    color: var(--text-main);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-body);
    border-color: var(--text-light);
}

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

.btn-outline:hover {
    background-color: var(--bg-body);
}

.btn-delete {
    background-color: #fee2e2;
    color: #991b1b;
    border-color: transparent;
}

.btn-delete:hover {
    background-color: #fecaca;
    color: #7f1d1d;
}

.btn-logout {
    color: var(--text-muted);
    padding: 0.5rem 1rem;
}

.btn-logout:hover {
    color: var(--error-text);
    background-color: var(--error-bg);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
}

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

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.form-control,
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: white;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
    color: var(--text-main);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    pointer-events: none;
}

.input-with-icon input {
    padding-left: 2.5rem !important;
}

/* Dashboard Header */
.dashboard-header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.dashboard-header h1 {
    font-size: 1.25rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-nav span {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
}

/* Main Grid */
.main-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    padding: 2rem 0;
    align-items: start;
}

.grid-single-col {
    grid-template-columns: 1fr !important;
}

/* Sidebar */
.sidebar-panel {
    background: var(--bg-sidebar);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 5.5rem;
}

.sidebar-panel h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.sidebar-panel ul li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 500;
}

.sidebar-panel ul li a:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.sidebar-panel ul li a i {
    width: 1.25rem;
    text-align: center;
}

/* Notes Grid/List */
.notes-container {
    width: 100%;
}

.note-card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: var(--shadow-sm);
}

.note-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.note-card-header {
    margin-bottom: 1rem;
}

.note-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    line-height: 1.4;
}

.note-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Badges */
.badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.badge-category {
    background-color: #f1f5f9;
    color: #475569;
}

.badge-encrypted {
    background-color: #fff7ed;
    color: #c2410c;
}

.badge-public {
    background-color: #eff6ff;
    color: #1d4ed8;
}

/* Note Content */
.note-excerpt {
    color: var(--text-muted);
    font-size: 0.925rem;
    line-height: 1.6;
    flex-grow: 1;
    margin-bottom: 1.5rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

.note-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.note-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.note-card:hover .note-actions {
    opacity: 1;
}

/* Editor */
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    height: calc(100vh - 140px);
}

.editor-pane, .preview-pane {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    overflow-y: auto;
    height: 100%;
}

.editor-header {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.preview-note {
    min-height: 100%;
    /* content styles */
}

/* File Upload */
#uploadForm {
    border: 2px dashed var(--border-color);
    transition: border-color 0.2s;
}

#uploadForm:hover {
    border-color: var(--primary-color);
}

.attachment-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.attachment-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.attachment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.attachment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.attachment-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.attachment-preview {
    border-radius: var(--radius-sm);
    background: #0f172a;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.attachment-preview img,
.attachment-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.attachment-preview audio {
    width: 100%;
}

.attachment-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.attachment-meta strong {
    font-size: 0.95rem;
    color: var(--text-main);
}

.attachment-meta span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.attachment-actions {
    display: flex;
    gap: 0.5rem;
}

/* Auth Pages */
.auth-container {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-body);
}

.auth-left {
    flex: 1;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.auth-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background: var(--bg-surface);
}

.auth-form {
    width: 100%;
    max-width: 420px;
}

/* Landing Page */
.home-header {
    background: white;
    padding: 1.5rem 0;
    box-shadow: var(--shadow-sm);
}

.home-header h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.hero-section {
    padding: 4rem 0;
    text-align: center;
}

.hero-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.hero-content p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 3rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin: 4rem 0;
}

.feature-card {
    background: white;
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.feature-icon {
    width: 3rem;
    height: 3rem;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.cta-section {
    margin-top: 4rem;
    text-align: center;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.info-section {
    background: var(--bg-surface);
    padding: 4rem 0;
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 3rem;
}

.home-footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
}

/* Texture Classes */
.texture-dots { background-image: radial-gradient(circle, #cbd5e1 1px, transparent 1px); background-size: 20px 20px; }
.texture-lines { background-image: repeating-linear-gradient(0deg, #f1f5f9, #f1f5f9 1px, transparent 1px, transparent 20px); }
.texture-grid { background-image: linear-gradient(#f1f5f9 1px, transparent 1px), linear-gradient(90deg, #f1f5f9 1px, transparent 1px); background-size: 20px 20px; }

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.alert-success {
    background-color: var(--success-bg);
    color: var(--success-text);
    border: 1px solid #bbf7d0;
}

.alert-error {
    background-color: var(--error-bg);
    color: var(--error-text);
    border: 1px solid #fecaca;
}

/* Responsive */
@media (max-width: 1024px) {
    .main-grid {
        grid-template-columns: 240px 1fr;
    }
    
    .auth-container {
        flex-direction: column;
    }
    
    .auth-left {
        padding: 2rem;
        min-height: 200px;
    }
}

@media (max-width: 768px) {
    .main-grid {
        grid-template-columns: 1fr;
        padding-top: 1rem;
    }

    .sidebar-panel {
        position: static;
        margin-bottom: 2rem;
    }

    .editor-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .editor-pane, .preview-pane {
        height: 600px;
    }
    
    .cta-buttons {
        flex-direction: column;
    }
}
