:root {
    --primary: #4a90e2;
    --secondary: #f5f6fa;
    --text-color: #2f3640;
    --danger: #e74c3c;
    --highlight: #fbc531;
    --bg-body: #dcdde1;
    --bg-container: white;
    --border: #eee;
    --hover: #f0f9ff;
    --padding-day: #fafafa;
    --current-day: #eaf2ff;
}

body.dark {
    --primary: #4a90e2;
    --secondary: #353b48;
    --text-color: #f5f6fa;
    --bg-body: #1e272e;
    --bg-container: #353b48;
    --border: #4b6584;
    --hover: #2f3640;
    --padding-day: #252c35;
    --current-day: #3c4a5d;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-color);
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.calendar-container {
    width: 95%;
    max-width: 900px;
    background: var(--bg-container);
    border-radius: 10px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    overflow: hidden;
}

.header {
    background: var(--primary);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 { margin: 0; font-size: 1.5rem; }

.nav-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

.nav-btn:hover { background: rgba(255,255,255,0.4); }

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

.filter-dropdown {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 8px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
}
.filter-dropdown option {
    background: var(--bg-container);
    color: var(--text-color);
}

.search-wrapper { position: relative; width: 100%; max-width: 200px; }
.search-input { padding: 8px; border-radius: 5px; border: none; outline: none; width: 100%; box-sizing: border-box; }

.suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-container);
    border: 1px solid var(--border);
    border-radius: 0 0 5px 5px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}
.suggestion-item { padding: 8px; cursor: pointer; border-bottom: 1px solid var(--border); }
.suggestion-item:hover { background: var(--hover); }

/* Footer for import/export */
.footer { padding: 10px; background: var(--secondary); text-align: right; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.file-btn { font-size: 0.8rem; cursor: pointer; color: var(--text-color); background: var(--bg-container); border: 1px solid var(--border); padding: 5px 10px; border-radius: 3px; }

@media (max-width: 600px) {
    body { align-items: flex-start; padding: 20px 0; }
    .header { flex-direction: column; gap: 10px; text-align: center; padding: 15px; }
    .controls { width: 100%; justify-content: space-between; }
    .search-wrapper { max-width: 100%; }
    .calendar-grid, .weekdays { padding: 5px; gap: 2px; }
    .day-cell { min-height: 60px; height: 90px; padding: 2px; overflow-y: auto; }
    .nav-btn { padding: 5px 10px; font-size: 0.8rem; }
    .header h1 { font-size: 1.2rem; }
    .weekdays div { font-size: 0.75rem; }
    .date-number { font-size: 0.8rem; }
    .event-tag { font-size: 0.65rem; padding: 1px 2px; }
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    background: var(--secondary);
    padding: 10px;
    gap: 10px;
    text-align: center;
    font-weight: bold;
    color: var(--text-color);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    padding: 10px;
    gap: 10px;
}

.day-cell {
    min-height: 100px;
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 5px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}

.day-cell:hover:not(.padding-day) {
    background: var(--hover);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.day-cell.padding-day { background: var(--padding-day); cursor: default; }
.day-cell.current-day { border: 2px solid var(--primary); background: var(--current-day); }
.day-cell.drag-over { background: #e6ffea; border: 2px dashed #2ed573; }

.date-number { font-weight: bold; margin-bottom: 5px; }

.event-tag {
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    padding: 2px 5px;
    border-radius: 3px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: grab;
}

body.dark .date-number {
    color: #fff;
}

.event-time {
    font-size: 0.7em;
    opacity: 0.8;
    margin-right: 4px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background: var(--bg-container);
    color: var(--text-color);
    padding: 25px;
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.modal h2 { margin-top: 0; color: var(--primary); }

input[type="text"] {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid var(--border);
    border-radius: 5px;
    box-sizing: border-box;
}

input, select, textarea {
    background: var(--bg-container);
    color: var(--text-color);
    border: 1px solid var(--border);
}

/* New inputs */
.input-group { display: flex; gap: 10px; margin-bottom: 10px; }
.input-group input, .input-group select { margin: 0; }

textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
    box-sizing: border-box;
    font-family: inherit;
    resize: vertical;
}

.event-list { margin: 15px 0; max-height: 150px; overflow-y: auto; }

.event-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: var(--secondary);
    margin-bottom: 5px;
    border-radius: 5px;
}

.delete-btn {
    color: var(--danger);
    background: none;
    border: none;
    cursor: pointer;
    font-weight: bold;
}

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

.btn { padding: 8px 16px; border: none; border-radius: 5px; cursor: pointer; font-weight: bold; }
.btn-primary { background: var(--primary); color: white; }
.btn-secondary { background: #ccc; color: var(--text-color); }

main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
    flex-direction: column;
}

/* Guide Modal Styles */
.guide-content { max-height: 300px; overflow-y: auto; line-height: 1.6; margin-bottom: 20px; }
.guide-content ul { padding-left: 20px; margin: 10px 0; }
.guide-content li { margin-bottom: 8px; }
.guide-key { background: #f0f0f0; padding: 2px 6px; border-radius: 4px; font-family: monospace; font-weight: bold; border: 1px solid #ddd; color: #333; font-size: 0.9em; }
body.dark .guide-key { background: #444; border-color: #555; color: #eee; }