:root {
    --primary-color: #4a90e2;
    --primary-dark: #357abd;
    --secondary-color: #50e3c2;
    --bg-color: #f4f7f6;
    --card-bg: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --accent-red: #e74c3c;
    --accent-green: #2ecc71;
    --accent-yellow: #f1c40f;
    --font-family: 'Outfit', sans-serif;
    --radius: 12px;
    --shadow: 0 4px 6px rgba(0,0,0,0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    height: 100vh; /* Fallback */
    height: 100dvh;
    overflow: hidden;
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-color);
}

/* Header */
.app-header {
    background: var(--card-bg);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    z-index: 10;
}

.logo {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Views */
.view {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow-y: auto;
    padding: 1rem;
    position: relative;
}

.view.active {
    display: flex;
}

/* UI Elements */
.icon-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.2s;
}

.icon-btn:active {
    background: rgba(0,0,0,0.05);
}

.text-btn {
    font-size: 1rem;
    color: var(--primary-color);
    font-weight: 600;
    width: auto;
    border-radius: var(--radius);
}

.btn-primary, .btn-secondary, .btn-outline, .btn-danger {
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius);
    border: none;
    font-family: inherit;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.1s;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:active {
    background: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-danger {
    background: var(--accent-red);
    color: white;
    margin-top: 1rem;
}

.full-width {
    width: 100%;
    display: block;
    margin-bottom: 0.5rem;
}

/* Search & Filter bar */
.filter-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-bar input, .filter-bar select {
    flex: 1;
    padding: 0.6rem;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    font-family: inherit;
}

/* Notes List */
.notes-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-bottom: 80px; /* Space for FAB */
}

.note-card {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform 0.1s;
    cursor: pointer;
    border-left: 4px solid var(--primary-color);
}

.note-card:active {
    transform: scale(0.98);
}

.note-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.note-emotion {
    font-weight: 600;
    color: var(--text-primary);
    text-transform: capitalize;
}

.note-preview {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.rating-badge {
    background: #eee;
    padding: 2px 6px;
    border-radius: 4px;
}

/* FAB */
.fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    font-size: 1.5rem;
    border: none;
    box-shadow: 0 4px 10px rgba(74, 144, 226, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: transform 0.2s;
}

.fab:active {
    transform: scale(0.9);
}

/* Editor */
.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
}

.form-group textarea {
    resize: vertical;
}

.emotion-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.emotion-chip {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    border-radius: 20px;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.emotion-chip.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.rating-input input {
    width: 100%;
    margin-bottom: 0.5rem;
}

.rating-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #ddd;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 1rem;
    backdrop-filter: blur(5px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: var(--radius);
    width: 100%;
    max-width: 350px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.lock-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.modal h3 {
    margin-bottom: 0.5rem;
}

.modal p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.modal input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 1rem;
    text-align: center;
}

.error-msg {
    color: var(--accent-red);
    margin-top: 0.5rem;
    font-size: 0.9rem;
    height: 1.2rem;
}

.hidden {
    display: none !important;
}
