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

:root {
    --bg-primary: #070b12;
    --bg-secondary: #0a0f1c;
    --bg-tertiary: #0e1523;
    --text-primary: #f1f5f9;
    --text-secondary: #64748b;
    --primary-color: #f59e0b;
    --primary-hover: #d97706;
    --accent-color: #fbbf24;
    --border-color: rgba(255, 255, 255, 0.06);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 12px 20px -3px rgba(0, 0, 0, 0.45), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
}

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

*:focus, 
*:focus-visible {
    outline: none !important;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #070b12;
    background-image: 
        radial-gradient(circle at 80% 20%, rgba(245,158,11,.02) 0%, transparent 50%),
        repeating-linear-gradient(0deg, rgba(0,0,0,.12) 0px, rgba(0,0,0,.12) 1px, transparent 1px, transparent 2px);
    background-size: 100% 100%, 100% 2px;
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Background Gradients */
body::before {
    content: '';
    position: fixed;
    top: -20%;
    left: -20%;
    width: 80vw;
    height: 80vh;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.09) 0%, rgba(0,0,0,0) 70%);
    z-index: -1;
    pointer-events: none;
    filter: blur(40px);
}

body::after {
    content: '';
    position: fixed;
    bottom: -20%;
    right: -20%;
    width: 80vw;
    height: 80vh;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.05) 0%, rgba(0,0,0,0) 70%);
    z-index: -1;
    pointer-events: none;
    filter: blur(40px);
}

/* Header & Navigation */
header {
    background-color: rgba(7, 11, 18, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'JetBrains Mono', 'DM Mono', monospace;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--primary-color);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.logo span {
    font-weight: 300;
    color: var(--text-primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-user {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.nav-user strong {
    color: var(--text-primary);
}

/* Main Container */
main {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

/* Forms & Auth Pages */
.auth-container {
    max-width: 440px;
    margin: 4rem auto;
    padding: 3rem;
    background: rgba(19, 28, 46, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

.auth-header {
    text-align: center;
    margin-bottom: 2.25rem;
}

.auth-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #ffffff, #c7d2fe);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

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

.auth-form .form-group {
    margin-bottom: 1.75rem;
}

.auth-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.auth-form input {
    width: 100%;
    padding: 0.85rem 1.15rem;
    font-family: inherit;
    font-size: 0.95rem;
    background-color: rgba(11, 15, 25, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: var(--text-primary);
    transition: all 0.25s ease;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: rgba(11, 15, 25, 0.85);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.auth-form .helptext {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.4rem;
    line-height: 1.4;
}

.auth-form ul.errorlist {
    list-style: none;
    padding: 0;
    margin: 0.4rem 0 0 0;
    color: #f87171;
    font-size: 0.8rem;
    font-weight: 500;
}

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

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

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

/* Django Form Styling Compatibility */
form p {
    margin-bottom: 1.25rem;
}

form p label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: var(--text-secondary);
}

form p input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

form p input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

form p .helptext {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

form ul.errorlist {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0;
    color: #f87171;
    font-size: 0.8rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    text-align: center;
    width: 100%;
}

button:focus,
.btn:focus {
    outline: none;
}

.btn-primary {
    background: var(--primary-color);
    color: #07090e;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

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

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

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    width: auto;
    font-size: inherit;
}

.btn-link:hover {
    text-decoration: underline;
    color: var(--accent-color);
}

/* Messages / Alerts */
.messages-container {
    max-width: 600px;
    margin: 0 auto 1.5rem auto;
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-left: 4px solid transparent;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border-left-color: #10b981;
}

.alert-error, .alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border-left-color: #ef4444;
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    border-left-color: #3b82f6;
}

/* Dashboard / Index styling placeholder */
.dashboard-container {
    text-align: center;
    padding: 4rem 2rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.dashboard-container h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff, var(--text-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.dashboard-container p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Footer */
footer {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
    background-color: rgba(11, 15, 25, 0.5);
}

.auth-form select {
    width: 100%;
    padding: 0.85rem 1.15rem;
    font-family: inherit;
    font-size: 0.95rem;
    background-color: rgba(11, 15, 25, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: var(--text-primary);
    transition: all 0.25s ease;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2em;
}

.auth-form select:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: rgba(11, 15, 25, 0.85);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.auth-form input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--primary-color);
    cursor: pointer;
    background-color: rgba(11, 15, 25, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

/* Help Text Styling */
.helptext {
    display: block;
    margin-top: 0.45rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.helptext ul {
    margin: 0.35rem 0 0 0;
    padding-left: 0;
    list-style-type: none;
}

.helptext li {
    position: relative;
    margin-bottom: 0.3rem;
    padding-left: 0.85rem;
}

.helptext li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: bold;
}

/* Error List Styling */
ul.errorlist {
    margin: 0.45rem 0 0 0;
    padding: 0;
    list-style: none;
}

ul.errorlist li {
    color: #f87171;
    font-size: 0.78rem;
    font-weight: 500;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 600px) {
    body {
        background-color: #070a13;
    }
    .nav-container {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem;
        align-items: center;
        text-align: center;
    }
    .nav-links {
        gap: 0.75rem;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }
    .nav-user {
        font-size: 0.8rem;
        display: block;
        margin-bottom: 0.25rem;
    }
    main {
        padding: 1.5rem 1rem;
    }
    .auth-container {
        margin: 1.5rem auto;
        padding: 1.75rem 1.25rem;
        border-radius: 14px;
        width: 100%;
        max-width: 100%;
    }
    .auth-header {
        margin-bottom: 1.5rem;
    }
    .auth-header h1 {
        font-size: 1.6rem;
    }
    footer {
        padding: 1.25rem 1rem;
        font-size: 0.8rem;
    }
    .notes-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }
    .dashboard-header-bar {
        flex-direction: column;
        align-items: stretch !important;
        gap: 1rem !important;
    }
    .dashboard-header-bar button {
        width: 100% !important;
    }
    /* Search form */
    form[method="get"] {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }
    form[method="get"] button, form[method="get"] a {
        width: 100% !important;
        justify-content: center;
    }
    /* Modal mobile styling */
    #createNoteModal > div {
        padding: 1.5rem !important;
        margin: 0 1rem;
    }
    /* Note details action buttons stacking */
    .detail-actions-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }
    .detail-actions-bar a, 
    .detail-actions-bar form, 
    .detail-actions-bar button {
        width: 100% !important;
        margin: 0 !important;
        justify-content: center !important;
        display: flex !important;
    }
}

/* Helper Utilities */
.justify-center {
    justify-content: center !important;
}
