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

:root {
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --accent: #8b5cf6; /* Stylish Purple */
    --accent-hover: #7c3aed;
    --danger: #ef4444;
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
    --glass-blur: blur(16px);
    --radius-lg: 20px;
    --radius-md: 14px;
}

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

html, body {
    /* Prevent pull-to-refresh completely */
    overscroll-behavior-y: contain;
}

body {
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    
    /* Elegant Stylish Purple Gradient */
    background: linear-gradient(45deg, #2e1065, #4c1d95, #6d28d9, #5b21b6, #3b0764);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Glassmorphism utility */
.glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: var(--radius-lg);
}

/* Screens */
.screen {
    display: none;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    padding: 20px;
    animation: fadeIn 0.4s ease forwards;
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Containers */
.auth-container {
    max-width: 400px;
    width: 100%;
    margin: auto;
    padding: 35px 30px;
    text-align: center;
}

.auth-icon {
    font-size: 48px;
    margin-bottom: 20px;
    background: -webkit-linear-gradient(#7dd3fc, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h1, h2 {
    font-weight: 700;
    margin-bottom: 12px;
}

p {
    color: var(--text-secondary);
    margin-bottom: 25px;
    line-height: 1.6;
    font-size: 15px;
}

/* Inputs & Buttons */
.input-group {
    margin-bottom: 20px;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

input[type="password"],
input[type="text"],
input[type="datetime-local"] {
    width: 100%;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.secure-input {
    -webkit-text-security: disc;
    text-security: disc;
}

input:focus, textarea:focus {
    outline: none;
    border-color: #38bdf8;
    background: rgba(0, 0, 0, 0.35);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.3);
}

::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.8;
    cursor: pointer;
}

button {
    width: 100%;
    padding: 15px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.4);
}

button:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.6);
}

button:active {
    transform: translateY(0);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--glass-border);
    box-shadow: none;
    margin-top: 10px;
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

.text-btn {
    background: none;
    border: none;
    color: #7dd3fc;
    font-size: 14px;
    margin-top: 20px;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    box-shadow: none;
}
.text-btn:hover {
    background: none;
    color: #ffffff;
    transform: none;
    box-shadow: none;
}

/* App Header & Clock */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0 20px 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-title {
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}
@media (max-width: 380px) {
    .hide-mobile { display: none; }
    .header-title { font-size: 18px; }
    .clock-display { font-size: 14px; padding: 4px 8px; }
    .icon-btn { width: 40px; height: 40px; }
}

.clock-display {
    font-size: 16px;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 14px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.header-actions {
    display: flex;
    gap: 10px;
}

.icon-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    width: 46px;
    height: 46px;
    border-radius: 50%;
    padding: 0;
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}
.tab-btn {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-secondary);
    box-shadow: none;
    border-radius: 30px;
    font-size: 14px;
    padding: 10px;
}
.tab-btn.active {
    background: white;
    color: #0f172a;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

/* Notes List */
.notes-container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    flex-grow: 1;
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding-bottom: 100px; /* space for FAB */
}

.note-card {
    padding: 22px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    min-height: 190px;
    display: flex;
    flex-direction: column;
}

.note-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 15px 35px 0 rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.note-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.note-preview {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    flex-grow: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    line-height: 1.5;
}

.note-image-thumb {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.note-meta-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 10px;
}

.note-date {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    gap: 4px;
}

.note-reminder-badge {
    font-size: 11px;
    background: #ef4444;
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 3px;
    box-shadow: 0 2px 5px rgba(239, 68, 68, 0.4);
    animation: pulse 2s infinite;
}
.note-reminder-badge.future {
    background: #0ea5e9;
    animation: none;
    box-shadow: none;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 15px;
    background: rgba(0,0,0,0.2);
}

.empty-state svg {
    margin-bottom: 15px;
    opacity: 0.7;
    color: #7dd3fc;
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 0 25px;
    height: 60px;
    border-radius: 30px;
    background: linear-gradient(135deg, #0ea5e9, #3b82f6);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 16px;
    box-shadow: 0 4px 25px rgba(14, 165, 233, 0.6);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100;
}

.fab:hover {
    transform: translateY(-4px) scale(1.05);
}

/* Editor Screen */
.editor-container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

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

.editor-actions {
    display: flex;
    gap: 10px;
}

.title-input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 32px;
    font-weight: 700;
    width: 100%;
    margin-bottom: 15px;
    font-family: inherit;
    padding: 0;
}

.editor-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.reminder-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.3);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,0.1);
}
.reminder-wrapper i {
    color: #7dd3fc;
}
.reminder-wrapper input {
    background: transparent;
    border: none;
    padding: 0;
    width: auto;
    color: white;
}

.content-textarea {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 20px;
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.7;
    width: 100%;
    flex-grow: 1;
    resize: none;
    font-family: inherit;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}

.image-upload-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}
.image-preview-container {
    position: relative;
    display: none;
    max-width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.image-preview-container img {
    width: 100%;
    display: block;
}
.btn-remove-image {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(239, 68, 68, 0.9);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.btn-add-image {
    background: rgba(255, 255, 255, 0.1);
    border: 1px dashed rgba(255, 255, 255, 0.4);
    color: white;
    padding: 12px;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.btn-add-image:hover {
    background: rgba(255, 255, 255, 0.2);
}
#note-image-input {
    display: none;
}

/* Manual Screen */
.manual-content {
    background: rgba(0,0,0,0.4);
    padding: 25px;
    border-radius: var(--radius-lg);
    line-height: 1.8;
}
.manual-content h3 {
    color: #7dd3fc;
    margin-top: 20px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 5px;
}
.manual-content ol {
    margin-left: 20px;
    margin-bottom: 20px;
}
.manual-content li {
    margin-bottom: 10px;
}

/* Alerts */
.alert-danger {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-success {
    color: #10b981;
    background: rgba(16, 185, 129, 0.15);
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

#file-input {
    display: none;
}

/* 401K History List */
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.history-item:last-child {
    border-bottom: none;
}
.h-date { font-size: 12px; color: rgba(255,255,255,0.6); }
.h-type { font-weight: bold; font-size: 14px; margin-bottom: 4px; }
.h-buy { color: #3b82f6; }
.h-sell { color: #10b981; }
.h-amount { font-size: 16px; font-weight: bold; }
.h-btn-del {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 5px;
    box-shadow: none;
    width: auto;
}
