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

:root {
    --primary-color: #3B82F6;
    --success-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --bg-color: #F9FAFB;
    --card-bg: #FFFFFF;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 30px 0;
    margin-bottom: 30px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #2563EB 100%);
    color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 8px;
    font-weight: 700;
}

header .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-md);
}

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

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #2563EB;
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    background: #4B5563;
}

.btn-secondary.active {
    background: var(--primary-color);
}

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

.btn-success:hover {
    background: #059669;
}

.btn-outline {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-link {
    background: transparent;
    color: var(--primary-color);
    text-decoration: none;
}

.btn-link:hover {
    text-decoration: underline;
}

.categories-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: var(--bg-color);
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.category-item:hover {
    border-color: var(--border-color);
}

.category-color-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
}

.category-name {
    font-weight: 500;
    margin-right: 10px;
}

.category-actions {
    display: flex;
    gap: 6px;
}

.btn-small {
    padding: 4px 10px;
    font-size: 0.85rem;
}

.input-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#noteInput {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    transition: border-color 0.2s ease;
}

#noteInput:focus {
    outline: none;
    border-color: var(--primary-color);
}

.input-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.category-select-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-select-container label {
    font-weight: 500;
    color: var(--text-secondary);
}

#categorySelect, #editNoteCategory {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    min-width: 150px;
    cursor: pointer;
}

.input-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.voice-status {
    padding: 10px 15px;
    background: #DBEAFE;
    color: #1E40AF;
    border-radius: var(--radius-md);
    font-weight: 500;
    text-align: center;
}

.voice-status.recording {
    background: #FEE2E2;
    color: #991B1B;
    animation: pulse 1.5s ease-in-out infinite;
}

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

.notes-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
}

#searchInput {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary-color);
}

.view-options {
    display: flex;
    gap: 10px;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.filter-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    color: white;
}

.filter-badge:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.filter-badge.active {
    border-color: var(--text-primary);
    box-shadow: var(--shadow-md);
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.sort-options label {
    font-weight: 500;
    color: var(--text-secondary);
}

#sortSelect {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    cursor: pointer;
}

.notes-list {
    display: grid;
    gap: 15px;
}

.note-card {
    padding: 20px;
    background: var(--bg-color);
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    transition: all 0.2s ease;
}

.note-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 10px;
}

.note-category-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.note-actions {
    display: flex;
    gap: 8px;
}

.note-content {
    margin: 15px 0;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-primary);
    word-wrap: break-word;
    white-space: pre-wrap;
}

.note-meta {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 12px;
    flex-wrap: wrap;
}

.note-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 30px;
}

.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: 1000;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

.modal-body {
    padding: 25px;
}

.form-group {
    margin-bottom: 20px;
}

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

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.color-picker-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

input[type="color"] {
    width: 60px;
    height: 40px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
}

#categoryColorHex {
    width: 100px;
}

.preset-colors {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.color-preset {
    width: 36px;
    height: 36px;
    border: 3px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-preset:hover {
    transform: scale(1.1);
    border-color: var(--text-primary);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 25px;
}

.help-content h4 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.help-content h4:first-child {
    margin-top: 0;
}

.help-content ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.help-content li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    header .subtitle {
        font-size: 1rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .input-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .input-buttons {
        width: 100%;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .notes-controls {
        flex-direction: column;
        width: 100%;
    }
    
    #searchInput {
        width: 100%;
    }
    
    .view-options {
        width: 100%;
        justify-content: space-between;
    }
    
    .note-header {
        flex-direction: column;
    }
    
    .note-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .modal-content {
        max-width: 95%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    section {
        padding: 15px;
    }
    
    header {
        padding: 20px 10px;
        margin-bottom: 20px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .section-header h2 {
        font-size: 1.2rem;
    }
}