@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --success: #10b981;
    --error: #ef4444;
    --sidebar-width: 260px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-dark);
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Glassmorphism Classes */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 16px;
}

.container {
    max-width: 1000px;
    margin: 40px auto;
    padding: 20px;
    width: 90%;
}

/* Header & Nav */
header {
    padding: 1.5rem 0;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #a78bfa, #f472b6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
    z-index: 1001;
    position: relative;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--text-main);
    /* Ensure visibility */
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links a i {
    font-size: 1.1rem;
    width: 20px;
}

.nav-links a:hover {
    color: var(--text-main);
}

.menu-toggle {
    display: none;
    font-size: 1.25rem;
    color: var(--text-main);
    cursor: pointer;
    z-index: 1001;
    width: 30px;
}

.mobile-only {
    display: none;
}

.close-menu {
    display: none;
    align-self: flex-end;
    font-size: 1.25rem;
    color: var(--text-main);
    cursor: pointer;
    margin-bottom: 20px;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: none;
    cursor: pointer;
}

.sidebar-overlay.active {
    display: block;
}

/* Auth Cards */
.auth-card {
    max-width: 400px;
    margin: 100px auto;
    padding: 2.5rem;
}

.auth-card h2 {
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 700;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

input,
textarea,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s, background 0.3s;
    border: none;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-block {
    display: block;
    width: 100%;
}

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Dashboard */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.note-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.note-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.3s;
    text-decoration: none;
    color: inherit;
}

.note-card:hover {
    transform: translateY(-5px);
}

.note-card h3 {
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.note-card p {
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
}

.note-meta {
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge-public {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.badge-private {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

/* Notepad Editor & Viewer */
.editor-container,
.view-container {
    padding: 3rem;
}

.view-meta {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.view-meta .badge {
    margin-left: auto;
}

.note-content {
    line-height: 1.8;
    font-size: 1.1rem;
    white-space: pre-wrap;
    color: rgba(255, 255, 255, 0.9);
}

.editor-header {
    margin-bottom: 1.5rem;
}

textarea#content {
    min-height: 400px;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
}

.share-panel {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--glass-border);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade {
    animation: fadeIn 0.5s ease-out forwards;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        width: 100%;
        margin: 0 auto;
        padding: 10px 20px;
    }

    header {
        position: relative;
        z-index: 2100;
        /* Header above content */
        padding: 0.75rem 0;
        margin-bottom: 2rem;
    }

    .logo {
        margin: 0 auto;
        font-size: 1.35rem !important;
        text-align: center;
        flex: 1;
        position: relative;
        z-index: 1;
    }

    .menu-toggle {
        display: block !important;
        font-size: 1.25rem;
        width: 30px;
        position: relative;
        z-index: 1;
    }

    .mobile-only {
        display: block;
    }

    .close-menu {
        display: block;
    }

    .nav-links {
        display: none;
        /* Hidden by default on mobile */
        position: fixed;
        top: 0;
        left: -100%;
        width: 260px;
        height: 100vh;
        background: #0f172a;
        flex-direction: column;
        padding: 40px 1.5rem;
        transition: left 0.3s ease;
        z-index: 2200;
        /* Sidebar above overlay */
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.8);
    }

    .nav-links.active {
        display: flex !important;
        left: 0;
    }

    .nav-links a {
        font-size: 0.95rem !important;
        padding: 18px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        color: #ffffff !important;
        /* Pure white for visibility */
        width: 100%;
        display: flex;
        align-items: center;
        gap: 12px;
    }

    h1 {
        font-size: 1.4rem !important;
    }

    h2 {
        font-size: 1.25rem !important;
    }

    h3 {
        font-size: 1.1rem !important;
    }

    p,
    span,
    label,
    input,
    textarea,
    .btn,
    .note-content {
        font-size: 0.9rem !important;
    }

    .view-meta {
        margin-bottom: 1.5rem;
        flex-wrap: wrap;
    }

    .view-meta .badge {
        margin-left: 0;
    }

    .note-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .note-card {
        padding: 1rem;
    }

    .note-card h3 {
        font-size: 1rem;
    }

    .editor-container,
    .view-container {
        padding: 2rem 1.75rem;
    }

    .auth-card {
        margin: 20px auto;
        padding: 1.25rem;
    }
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: var(--error);
    color: white;
}

.btn-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background: var(--success);
    color: white;
}