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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
    transition: background 0.3s ease;
}

body.night-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e6e6e6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.night-mode .container {
    background: #2d2d2d;
    color: #e6e6e6;
}

header {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.night-mode header {
    background: linear-gradient(135deg, #4a0072 0%, #002db3 100%);
}

header h1 {
    font-size: 2.2em;
    margin-bottom: 10px;
}

header p {
    opacity: 0.9;
    font-size: 1.1em;
}

.controls {
    padding: 25px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.night-mode .controls {
    background: #3d3d3d;
}

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

#memoInput, #searchInput {
    padding: 14px;
    font-size: 1.1em;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    width: 100%;
    transition: border-color 0.3s ease;
}

.night-mode #memoInput, 
.night-mode #searchInput {
    background: #4d4d4d;
    color: #e6e6e6;
    border-color: #5d5d5d;
}

#memoInput:focus, #searchInput:focus {
    outline: none;
    border-color: #2575fc;
    box-shadow: 0 0 0 3px rgba(37, 117, 252, 0.1);
}

.night-mode #memoInput:focus, 
.night-mode #searchInput:focus {
    border-color: #64b5f6;
    box-shadow: 0 0 0 3px rgba(100, 181, 246, 0.2);
}

button {
    padding: 12px 20px;
    font-size: 1em;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#addMemoBtn {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    align-self: stretch;
    min-width: 140px;
}

#addMemoBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 117, 252, 0.3);
}

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

.search-container {
    flex: 1;
    min-width: 200px;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-btn {
    background: #e9ecef;
    color: #495057;
    padding: 8px 16px;
}

.night-mode .filter-btn {
    background: #5d5d5d;
    color: #e6e6e6;
}

.filter-btn.active, .filter-btn:hover {
    background: #2575fc;
    color: white;
}

.night-mode .filter-btn.active, 
.night-mode .filter-btn:hover {
    background: #64b5f6;
    color: #2d2d2d;
}

.stats {
    padding: 15px 25px;
    background: #f8f9fa;
    display: flex;
    justify-content: space-around;
    border-bottom: 1px solid #e9ecef;
    font-weight: 500;
    flex-wrap: wrap;
    gap: 10px;
}

.night-mode .stats {
    background: #3d3d3d;
    border-bottom: 1px solid #5d5d5d;
}

.memo-list {
    list-style: none;
    max-height: 500px;
    overflow-y: auto;
}

.memo-item {
    display: flex;
    align-items: center;
    padding: 16px 25px;
    border-bottom: 1px solid #eee;
    animation: fadeIn 0.3s ease;
    transition: background-color 0.3s ease;
    position: relative;
}

.night-mode .memo-item {
    border-bottom: 1px solid #5d5d5d;
}

.memo-item:hover {
    background-color: #f8f9fa;
}

.night-mode .memo-item:hover {
    background-color: #3d3d3d;
}

.memo-item.completed {
    background-color: #f8f9ff;
}

.night-mode .memo-item.completed {
    background-color: #2a2a2a;
}

.memo-item.high-priority {
    border-left: 4px solid #ff4d4d;
}

.memo-item.medium-priority {
    border-left: 4px solid #ffcc00;
}

.memo-item.low-priority {
    border-left: 4px solid #00cc66;
}

.memo-checkbox {
    margin-right: 15px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.memo-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.memo-text {
    font-size: 1.1em;
    word-break: break-word;
    padding-right: 15px;
}

.memo-meta {
    display: flex;
    gap: 15px;
    font-size: 0.85em;
    color: #6c757d;
}

.night-mode .memo-meta {
    color: #aaa;
}

.memo-tag {
    background: #e9ecef;
    color: #495057;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8em;
}

.night-mode .memo-tag {
    background: #5d5d5d;
    color: #e6e6e6;
}

.memo-actions {
    display: flex;
    gap: 10px;
}

.memo-actions button {
    padding: 6px 12px;
    font-size: 0.9em;
}

.edit-btn {
    background: #ffc107;
    color: #212529;
}

.delete-btn {
    background: #dc3545;
    color: white;
}

.more-options-btn {
    background: #6c757d;
    color: white;
}

.edit-input {
    flex-grow: 1;
    padding: 8px;
    font-size: 1.1em;
    border: 2px solid #2575fc;
    border-radius: 4px;
    margin-right: 10px;
}

.night-mode .edit-input {
    background: #4d4d4d;
    color: #e6e6e6;
    border-color: #64b5f6;
}

.priority-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

.priority-high {
    background-color: #ff4d4d;
}

.priority-medium {
    background-color: #ffcc00;
}

.priority-low {
    background-color: #00cc66;
}

.actions {
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    background: #f8f9fa;
}

.night-mode .actions {
    background: #3d3d3d;
}

.import-export {
    display: flex;
    gap: 10px;
}

.actions button {
    background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
    color: #333;
    font-weight: 600;
}

.night-mode .actions button {
    background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%);
    color: #2d2d2d;
}

.actions button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 154, 158, 0.3);
}

.night-mode .actions button:hover {
    box-shadow: 0 5px 15px rgba(161, 140, 209, 0.3);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: none;
    border-radius: 8px;
    width: 80%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.night-mode .modal-content {
    background-color: #3d3d3d;
    color: #e6e6e6;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.night-mode .close:hover {
    color: #fff;
}

.option-form {
    margin-top: 15px;
}

.option-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.option-form select, 
.option-form input {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.night-mode .option-form select,
.night-mode .option-form input {
    background: #4d4d4d;
    color: #e6e6e6;
    border: 1px solid #5d5d5d;
}

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

@media (max-width: 768px) {
    .container {
        margin: 10px;
        border-radius: 8px;
    }
    
    header {
        padding: 20px;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    .controls {
        padding: 20px;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    #addMemoBtn {
        align-self: stretch;
    }
    
    .advanced-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-buttons {
        flex-wrap: wrap;
    }
    
    .stats {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }
    
    .actions {
        flex-direction: column;
        align-items: center;
    }
    
    .import-export {
        width: 100%;
        justify-content: center;
    }
    
    .actions button {
        width: 100%;
        max-width: 250px;
    }
}