/* Ghost Notes - Dark Ghostly Theme */
:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --accent-ghost: #4a90e2;
    --accent-danger: #e74c3c;
    --accent-warning: #f39c12;
    --accent-success: #27ae60;
    --border-color: #333333;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --ghost-glow: rgba(74, 144, 226, 0.3);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    user-select: none; /* Prevent text selection for app-like feel */
}

/* Screen Management */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.screen.active {
    display: flex;
}

/* Login Screen */
#login-screen {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
}

.ghost-container {
    text-align: center;
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 40px var(--shadow-color);
    max-width: 400px;
    width: 90%;
}

.ghost-logo {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: ghostFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 0 20px var(--ghost-glow));
}

@keyframes ghostFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.ghost-container h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-ghost));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-style: italic;
}

.pin-entry {
    margin-bottom: 2rem;
}

#pin-input {
    width: 100%;
    padding: 1rem;
    font-size: 1.2rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    text-align: center;
    letter-spacing: 0.2em;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#pin-input:focus {
    outline: none;
    border-color: var(--accent-ghost);
    box-shadow: 0 0 20px var(--ghost-glow);
}

.attempts-remaining {
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.error-message {
    margin-top: 0.5rem;
    color: var(--accent-danger);
    font-size: 0.9rem;
    min-height: 1.2rem;
}

.unlock-btn, .setup-btn, .create-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: bold;
    background: linear-gradient(135deg, var(--accent-ghost), #357abd);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-bottom: 1rem;
}

.unlock-btn:hover, .create-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px var(--ghost-glow);
}

.setup-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0.8rem;
}

.setup-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

/* Setup Screen */
#setup-screen {
    justify-content: center;
    align-items: center;
    background: var(--bg-primary);
}

.setup-container {
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 40px var(--shadow-color);
    max-width: 500px;
    width: 90%;
}

.setup-container h2 {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--accent-ghost);
}

.setup-container p {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

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

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

.form-group input, .form-group select {
    width: 100%;
    padding: 0.8rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--accent-ghost);
    box-shadow: 0 0 10px var(--ghost-glow);
}

.cancel-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0.8rem 2rem;
    border-radius: 8px;
    cursor: pointer;
    margin-left: 1rem;
}

.cancel-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

/* Main App Screen */
#app-screen {
    flex-direction: column;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 10px var(--shadow-color);
}

.app-header h1 {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-ghost));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.session-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.lock-timer {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-family: monospace;
}

.lock-now-btn {
    padding: 0.5rem 1rem;
    background: var(--accent-danger);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s ease;
}

.lock-now-btn:hover {
    background: #c0392b;
}

.app-main {
    display: flex;
    flex: 1;
    height: calc(100vh - 80px);
}

.notes-sidebar {
    width: 300px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 1.2rem;
}

.new-note-btn {
    background: var(--accent-ghost);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.new-note-btn:hover {
    transform: scale(1.1);
}

.notes-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.note-item {
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.note-item:hover {
    background: var(--border-color);
    transform: translateX(5px);
}

.note-item.active {
    background: var(--accent-ghost);
    color: white;
}

.note-item-title {
    font-weight: bold;
    margin-bottom: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-item-preview {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-item-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.note-editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.welcome-message {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.welcome-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.welcome-message h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.welcome-message p {
    margin-bottom: 0.5rem;
    max-width: 500px;
    line-height: 1.5;
}

.note-editor {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
}

.note-title {
    flex: 1;
    padding: 0.8rem;
    font-size: 1.5rem;
    font-weight: bold;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
}

.note-title:focus {
    outline: none;
    border-color: var(--accent-ghost);
    box-shadow: 0 0 10px var(--ghost-glow);
}

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

.save-btn, .delete-btn {
    padding: 0.8rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    transition: background 0.2s ease;
}

.save-btn {
    background: var(--accent-success);
    color: white;
}

.save-btn:hover {
    background: #219a52;
}

.delete-btn {
    background: var(--accent-danger);
    color: white;
}

.delete-btn:hover {
    background: #c0392b;
}

.note-content {
    flex: 1;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.6;
    resize: none;
    font-family: inherit;
}

.note-content:focus {
    outline: none;
    border-color: var(--accent-ghost);
    box-shadow: 0 0 10px var(--ghost-glow);
}

.note-metadata {
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 15px;
    border: 1px solid var(--border-color);
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 40px var(--shadow-color);
}

.warning-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.modal-content h2 {
    margin-bottom: 1rem;
    color: var(--accent-warning);
}

.modal-content p {
    margin-bottom: 2rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

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

.extend-btn, .lock-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s ease, transform 0.2s ease;
}

.extend-btn {
    background: var(--accent-success);
    color: white;
}

.extend-btn:hover {
    background: #219a52;
    transform: translateY(-2px);
}

.lock-btn {
    background: var(--accent-danger);
    color: white;
}

.lock-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 2000;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    font-size: 4rem;
    animation: ghostFloat 2s ease-in-out infinite;
    filter: drop-shadow(0 0 30px var(--ghost-glow));
    margin-bottom: 1rem;
}

.loading-text {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-main {
        flex-direction: column;
    }
    
    .notes-sidebar {
        width: 100%;
        height: 40%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .note-editor-container {
        height: 60%;
    }
    
    .app-header {
        padding: 1rem;
    }
    
    .app-header h1 {
        font-size: 1.4rem;
    }
    
    .editor-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .editor-actions {
        margin-top: 1rem;
        justify-content: center;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
} 