* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    font-weight: 300;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.nav-btn {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

#currentMonth {
    font-size: 1.5rem;
    font-weight: 500;
    min-width: 200px;
}

.task-panel {
    padding: 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.task-panel h3 {
    margin-bottom: 20px;
    color: #495057;
    font-size: 1.3rem;
}

.task-input {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.task-input input, .task-input select {
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.task-input input:focus, .task-input select:focus {
    outline: none;
    border-color: #667eea;
}

#taskName {
    flex: 1;
    min-width: 200px;
}

#taskColor {
    min-width: 120px;
}

#addTask {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease;
}

#addTask:hover {
    background: #5a6fd8;
}

.task-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 8px 15px;
    border-radius: 20px;
    border: 2px solid #e9ecef;
    font-size: 0.9rem;
}

.task-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

.task-remove {
    background: #dc3545;
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-container {
    padding: 30px;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    margin-bottom: 10px;
}

.day-header {
    background: #f8f9fa;
    padding: 15px;
    text-align: center;
    font-weight: 600;
    color: #495057;
    border: 1px solid #e9ecef;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e9ecef;
    border: 1px solid #e9ecef;
}

.calendar-day {
    background: white;
    min-height: 120px;
    padding: 8px;
    border: 1px solid #e9ecef;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.calendar-day:hover {
    background: #f8f9fa;
}

.calendar-day.other-month {
    background: #f8f9fa;
    color: #adb5bd;
}

.calendar-day.today {
    background: #e3f2fd;
    border: 2px solid #2196f3;
}

.day-number {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.day-quarters {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 1px;
}

.quarter {
    background: transparent;
    border: 1px solid rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    font-weight: 600;
}

.quarter:hover {
    background: rgba(0,0,0,0.05);
}

.quarter.has-task {
    opacity: 0.9;
}

.quarter.has-task:hover {
    opacity: 1;
    transform: scale(1.02);
}

.instructions {
    padding: 30px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.instructions h3 {
    margin-bottom: 15px;
    color: #495057;
}

.instructions ul {
    list-style: none;
    padding-left: 0;
}

.instructions li {
    padding: 5px 0;
    color: #6c757d;
    position: relative;
    padding-left: 20px;
}

.instructions li::before {
    content: "•";
    color: #667eea;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Notes Panel Styles */
.notes-panel {
    padding: 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.notes-panel h3 {
    margin-bottom: 20px;
    color: #495057;
    font-size: 1.3rem;
}

.notes-input {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.notes-input input, .notes-input textarea, .notes-input select {
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.notes-input textarea {
    min-height: 80px;
    resize: vertical;
}

.notes-input input:focus, .notes-input textarea:focus, .notes-input select:focus {
    outline: none;
    border-color: #667eea;
}

#addNote {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease;
    align-self: flex-start;
}

#addNote:hover {
    background: #218838;
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.note-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    position: relative;
}

.note-item h4 {
    margin: 0 0 8px 0;
    color: #495057;
    font-size: 1.1rem;
}

.note-item p {
    margin: 0 0 8px 0;
    color: #6c757d;
    line-height: 1.4;
}

.note-item .note-repeat {
    font-size: 0.8rem;
    color: #667eea;
    font-weight: 600;
    text-transform: uppercase;
}

.note-item .note-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
}

.note-edit, .note-delete {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.note-edit {
    color: #007bff;
}

.note-edit:hover {
    background: #e3f2fd;
}

.note-delete {
    color: #dc3545;
}

.note-delete:hover {
    background: #f8d7da;
}

/* Modal Styles */
.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: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 15px;
    right: 20px;
}

.close:hover {
    color: #000;
}

#modalTitle {
    margin-bottom: 10px;
    color: #495057;
}

#modalDate {
    color: #6c757d;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

#modalNotes {
    margin-bottom: 20px;
}

.day-note {
    background: #f8f9fa;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.day-note h4 {
    margin: 0 0 8px 0;
    color: #495057;
}

.day-note p {
    margin: 0;
    color: #6c757d;
}

.modal-actions {
    text-align: center;
}

#addNoteToDay {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease;
}

#addNoteToDay:hover {
    background: #5a6fd8;
}

/* Add Note Form Styles */
.add-note-form {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    border: 2px solid #e9ecef;
}

.add-note-form h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 1.2rem;
}

.add-note-form input, .add-note-form textarea, .add-note-form select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 15px;
    font-family: inherit;
    box-sizing: border-box;
}

.add-note-form input:focus, .add-note-form textarea:focus, .add-note-form select:focus {
    outline: none;
    border-color: #667eea;
}

.add-note-form textarea {
    min-height: 80px;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

#saveNote {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease;
}

#saveNote:hover {
    background: #218838;
}

#cancelNote {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease;
}

#cancelNote:hover {
    background: #5a6268;
}

/* Calendar day note indicator */
.calendar-day.has-notes::after {
    content: "📝";
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 12px;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .container {
        margin: 5px;
        border-radius: 10px;
        min-height: 100vh;
    }
    
    header {
        padding: 15px;
        position: sticky;
        top: 0;
        z-index: 100;
    }
    
    header h1 {
        font-size: 1.8rem;
        margin-bottom: 15px;
    }
    
    .controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .nav-btn {
        padding: 12px 20px;
        font-size: 1.1rem;
        min-width: 120px;
    }
    
    .task-input {
        flex-direction: column;
        gap: 10px;
    }
    
    .task-input input, .task-input select {
        padding: 15px;
        font-size: 1.1rem;
    }
    
    #addTask {
        padding: 15px 25px;
        font-size: 1.1rem;
    }
    
    .calendar-container {
        padding: 15px;
    }
    
    .calendar-day {
        min-height: 100px;
        padding: 6px;
    }
    
    .day-number {
        font-size: 1rem;
        margin-bottom: 8px;
    }
    
    .quarter {
        font-size: 0.7rem;
        padding: 2px;
    }
    
    .modal-content {
        margin: 2% auto;
        width: 95%;
        max-height: 90vh;
        padding: 20px;
    }
    
    .add-note-form input, .add-note-form textarea, .add-note-form select {
        padding: 15px;
        font-size: 1.1rem;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    #saveNote, #cancelNote {
        padding: 15px;
        font-size: 1.1rem;
        width: 100%;
    }
    
    .instructions {
        padding: 20px;
        font-size: 0.9rem;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .calendar-day {
        min-height: 120px;
    }
    
    .quarter {
        min-height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .nav-btn, #addTask, #addNoteToDay {
        min-height: 44px;
        min-width: 44px;
    }
    
    .task-remove, .note-edit, .note-delete {
        min-width: 44px;
        min-height: 44px;
    }
}
