:root {
    --bg-color: #121212;
    --primary-color: #1e1e1e;
    --secondary-color: #2d2d2d;
    --accent-color: #00ff7f;
    --text-color: #e0e0e0;
    --secondary-text: #a0a0a0;
    --border-color: #444;
    --shadow-color: rgba(0, 255, 127, 0.1);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

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

header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-container {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-container input {
    width: 100%;
    padding: 0.5rem 2rem 0.5rem 1rem;
    background-color: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
}

.search-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-text);
    pointer-events: none;
}

.filter-options select {
    padding: 0.5rem;
    background-color: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    cursor: pointer;
}

.editor-header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

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

.editor-toolbar button {
    background: none;
    border: 1px solid transparent;
    color: var(--text-color);
    padding: 0.35rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.editor-toolbar button:hover {
    background-color: var(--secondary-color);
}

.separator {
    width: 1px;
    background-color: var(--border-color);
    margin: 0 0.25rem;
}

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

.tags-input {
    flex: 1;
    padding: 0.5rem;
    background-color: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
}

.editor-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background-color: var(--secondary-color);
}

.editor-main {
    display: flex;
    height: calc(100% - 100px);
}

.editor-content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.title-editable, .content-editable {
    width: 100%;
    outline: none;
    background: transparent;
    color: var(--text-color);
    border: none;
    resize: none;
    font-family: inherit;
}

.title-editable {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
    min-height: 2.5rem;
}

.content-editable {
    min-height: 300px;
    line-height: 1.6;
}

.title-editable[contenteditable=true]:empty::before,
.content-editable[contenteditable=true]:empty::before {
    content: attr(data-placeholder);
    color: var(--secondary-text);
    pointer-events: none;
}

.note-preview {
    width: 40%;
    padding: 1rem;
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
    display: none;
}

.note-preview h1, .note-preview h2, .note-preview h3 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

.note-preview ul, .note-preview ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.note-preview a {
    color: var(--accent-color);
    text-decoration: none;
}

.note-preview a:hover {
    text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .header-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-container {
        max-width: 100%;
    }
    
    .editor-main {
        flex-direction: column;
        height: auto;
    }
    
    .note-preview {
        width: 100%;
        height: 300px;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
}

h1 {
    color: var(--accent-color);
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn {
    background-color: var(--accent-color);
    color: var(--bg-color);
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

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

.btn-cancel:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.note-card {
    background-color: var(--primary-color);
    border-radius: 8px;
    padding: 1.2rem;
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    height: 200px;
    display: flex;
    flex-direction: column;
}

.note-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.note-card h3 {
    color: var(--accent-color);
    margin-bottom: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-card p {
    color: var(--text-color);
    font-size: 0.95rem;
    flex-grow: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    line-clamp: 5;
    text-overflow: ellipsis;
}

.note-card .note-date {
    color: var(--secondary-text);
    font-size: 0.8rem;
    margin-top: 0.8rem;
    text-align: right;
}

.note-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.8rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.note-card:hover .note-actions {
    opacity: 1;
}

.note-actions button {
    background: none;
    border: none;
    color: var(--secondary-text);
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.note-actions button:hover {
    color: var(--accent-color);
    background-color: rgba(0, 255, 127, 0.1);
}

.no-notes {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 2rem;
    color: var(--secondary-text);
}

.no-notes i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
    opacity: 0.5;
}

.note-editor {
    background-color: var(--primary-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: none;
}

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

#note-title {
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 1.5rem;
    font-weight: bold;
    width: 100%;
    margin-right: 1rem;
    padding: 0.5rem 0;
    border-bottom: 2px solid var(--border-color);
}

#note-title:focus {
    outline: none;
    border-bottom-color: var(--accent-color);
}

#note-content {
    width: 100%;
    min-height: 300px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    color: var(--text-color);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
}

#note-content:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 255, 127, 0.2);
}

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

/* Custom Alert */
.alert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.alert-box {
    background-color: var(--primary-color);
    padding: 2rem;
    border-radius: 15px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    text-align: center;
    width: 90%;
    max-width: 400px;
}

.alert-box h2 {
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.alert-box p {
    margin-bottom: 1.5rem;
    color: var(--secondary-text);
}

.alert-box button {
    background-color: var(--accent-color);
    color: var(--bg-color);
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.alert-box button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .editor-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .editor-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .notes-grid {
        grid-template-columns: 1fr;
    }
}

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.note-card {
    animation: fadeIn 0.3s ease-out forwards;
}