:root {
    --primary-color: #4CAF50;
    --secondary-color: #2196F3;
    --dark-color: #333;
    --light-color: #f5f5f5;
    --gray-color: #e0e0e0;
    --danger-color: #f44336;
    --warning-color: #ff9800;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f9f9f9;
    color: #333;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background-color: white;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.app-header {
    padding: 20px;
    border-bottom: 1px solid var(--gray-color);
}

.app-header h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-box {
    padding: 15px;
    display: flex;
    border-bottom: 1px solid var(--gray-color);
}

.search-box input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--gray-color);
    border-radius: 4px 0 0 4px;
    outline: none;
}

.search-box button {
    padding: 10px 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}

.sidebar-menu {
    padding: 15px 0;
    border-bottom: 1px solid var(--gray-color);
}

.sidebar-menu ul {
    list-style: none;
}

.sidebar-menu li {
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.2s;
}

.sidebar-menu li:hover {
    background-color: var(--light-color);
}

.sidebar-menu li.active {
    background-color: rgba(76, 175, 80, 0.1);
    border-left: 4px solid var(--primary-color);
    font-weight: 500;
}

.tags-section {
    padding: 15px 0;
    flex: 1;
    overflow-y: auto;
}

.tags-header {
    padding: 0 20px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tags-header h3 {
    font-size: 1rem;
    color: #666;
}

#add-tag-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 1rem;
}

.tags-list {
    list-style: none;
}

.tags-list li {
    padding: 8px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tags-list li:hover {
    background-color: var(--light-color);
}

.tags-list li .tag-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--light-color);
}

.notes-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#notes-title {
    font-size: 1.5rem;
    color: var(--dark-color);
}

.notes-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

#new-note-btn {
    padding: 10px 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.view-toggle {
    display: flex;
    background-color: white;
    border: 1px solid var(--gray-color);
    border-radius: 4px;
    overflow: hidden;
}

.view-btn {
    padding: 8px 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
}

.view-btn.active {
    background-color: var(--primary-color);
    color: white;
}

.notes-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: grid;
    gap: 20px;
}

.notes-container.grid-view {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.notes-container.list-view {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.note-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding: 15px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    height: fit-content;
}

.note-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.note-card.pinned::before {
    content: '\f08d';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 10px;
    right: 10px;
    color: var(--warning-color);
}

.note-card .note-title {
    font-weight: 600;
    margin-bottom: 10px;
    word-break: break-word;
}

.note-card .note-content {
    color: #555;
    font-size: 0.9rem;
    margin-bottom: 15px;
    word-break: break-word;
    max-height: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-card .note-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}

.note-card .note-tag {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 20px;
    background-color: #e0e0e0;
}

.note-card .note-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #888;
}

.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #888;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: var(--gray-color);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--gray-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.2rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--gray-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-footer button {
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.modal-footer button:first-child {
    background-color: var(--primary-color);
    color: white;
    border: none;
}

.modal-footer button:last-child {
    background-color: white;
    border: 1px solid var(--gray-color);
}

/* Note Editor Styles */
.note-toolbar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--gray-color);
}

.color-picker {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-picker span {
    font-size: 0.9rem;
    color: #666;
}

.color-option {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
}

.color-option.selected {
    border-color: var(--dark-color);
}

.note-actions {
    display: flex;
    gap: 10px;
}

.note-actions button {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 1rem;
}

.note-actions button:hover {
    color: var(--primary-color);
}

#note-title {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid var(--gray-color);
    border-radius: 4px;
    font-size: 1.2rem;
    outline: none;
}

#editor-container {
    height: 300px;
    margin-bottom: 20px;
}

.tags-input-container {
    margin-top: 20px;
}

.tags-input-container label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #666;
}

.tags-input {
    position: relative;
}

#tags-input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--gray-color);
    border-radius: 4px;
    outline: none;
}

.tags-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: white;
    border: 1px solid var(--gray-color);
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 150px;
    overflow-y: auto;
    display: none;
    z-index: 10;
}

.tags-suggestions.active {
    display: block;
}

.tags-suggestions li {
    padding: 8px 12px;
    cursor: pointer;
}

.tags-suggestions li:hover {
    background-color: var(--light-color);
}

.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
}

.selected-tag {
    background-color: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.selected-tag .remove-tag {
    cursor: pointer;
    font-size: 0.7rem;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
    }
    
    .main-content {
        height: calc(100vh - 200px);
    }
    
    .notes-container.grid-view {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 480px) {
    .notes-container.grid-view {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
    }
}