@charset "UTF-8";
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700;900&display=swap');

* {
    box-sizing: border-box;
}

:root {
    /* Primary Colors */
    --primary-color: #E60012;
    --secondary-color: #4FAA00;

    /* Text Colors */
    --text-dark: #222222;
    --text-gray: #666666;

    /* Background Colors */
    --bg-white: #FFFFFF;
    --bg-light: #F8F9FA;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: var(--bg-light);
    display: flex;
    align-items: flex-start;
    /* Changed from center to prevent jumping */
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding-top: 20px;
    /* Add space at top */
}

.calendar-wrapper {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    padding: 30px;
    width: 100%;
    max-width: 1200px;
}

.calendar-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 30px 30px;
    border-bottom: 2px solid #f0f0f0;
    margin-left: -30px;
    margin-right: -45px;
    width: calc(100% + 75px);
    box-sizing: border-box;
    position: relative;
    gap: 15px;
}

.title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: 100%;
}

.calendar-header h2 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-dark);
    margin: 0;
    text-align: center;
    white-space: nowrap;
}

.native-expr-btn {
    position: absolute;
    right: 30px;
    top: 20px;
    background-color: #2c3e50;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background 0.3s;
    font-size: 0.9rem;
}

.nav-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background-color: #f8f9fa;
    color: var(--text-gray);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.calendar-body {
    padding: 20px 0 0 0;
}

.weeks {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-gap: 10px;
    margin: 0 0 10px 0;
    padding: 0 10px;
    padding-inline-start: 0;
    list-style: none;
}

.weeks li {
    font-weight: 700;
    text-align: center;
    padding: 0;
    color: var(--text-gray);
    font-size: 1.1rem;
}

/* Sunday Red */
.weeks li:first-child {
    color: var(--primary-color);
}

/* Saturday Blue */
.weeks li:last-child {
    color: #4dc3fa;
}

.days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-gap: 10px;
    list-style: none;
    padding: 10px;
    margin: 0;
    background-color: #f4f6f8;
}

.days li {
    height: 130px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 10px;
    cursor: pointer;
    position: relative;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-dark);
    border: 1px solid #eaeaea;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.days li:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.days li.inactive {
    color: #ccc;
    background-color: #f9fafb;
    box-shadow: none;
    border: 1px solid transparent;
}

.days li.active {
    background-color: #fff0f0;
}

.days li.active::before {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    background-color: var(--primary-color);
    border-radius: 50%;
}

.event-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--secondary-color);
    margin-top: 5px;
}

.days li.holiday {
    color: var(--primary-color);
}

.holiday-name {
    font-size: 0.75rem;
    color: var(--primary-color);
    margin-top: 4px;
    font-weight: 400;
    text-align: left;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.icon-wrapper {
    margin-top: auto;
    display: flex;
    justify-content: flex-end;
    gap: 2px !important;
    padding-top: 5px;
    flex-wrap: nowrap;
    white-space: nowrap;
    width: 100%;
}

.icon-wrapper i {
    font-size: 0.85rem;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 15px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-body-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.event-list-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    max-height: 120px;
    overflow-y: auto;
    border: 1px solid #eee;
}

.modal-event-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.modal-event-list li {
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-event-list li:hover {
    background-color: #f0f0f0;
}

.modal-event-list li.selected {
    background-color: #e6f7ff;
    border-color: #0056b3;
    color: #0056b3;
    font-weight: 700;
}

.modal-event-list li.empty-message {
    text-align: center;
    color: #888;
    background: transparent;
    border: none;
    cursor: default;
}

.btn-new {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
}

.btn-new:hover {
    background-color: #218838;
}

.modal-form {
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-btn:hover {
    color: #000;
}

#modalDate {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-dark);
    text-align: center;
}

#eventTitle {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 700;
    width: 100%;
    box-sizing: border-box;
}

#eventContent {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    width: 100%;
    box-sizing: border-box;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-save {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 700;
}

.btn-save:hover {
    background-color: #cc0010;
}

.btn-delete {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 700;
}

.event-item {
    background-color: #e6f7ff;
    color: #0056b3;
    font-size: 0.75rem;
    padding: 2px 4px;
    border-radius: 4px;
    margin-top: 4px;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 700;
    text-align: left;
}

.event-item.recurring {
    color: #cc0000;
}

.event-item.priority-event {
    background-color: #fff0f0;
    color: #d9534f;
    font-weight: 800;
    border: 1px solid #ffcccc;
}

.priority-input {
    width: 60px;
    padding: 8px;
    border: 1px solid #ffcccc;
    background-color: #fff5f5;
    color: #d9534f;
    border-radius: 6px;
    font-weight: bold;
    text-align: center;
}

.daily-stats-header {
    font-size: 0.75rem;
    color: #d9534f;
    background-color: transparent;
    padding: 0;
    margin-left: 5px;
    font-weight: normal;
    display: inline-block;
    vertical-align: middle;
    border: none;
}

.memo-icon {
    font-size: 0.95rem;
    color: #cccccc;
    cursor: pointer;
    margin-left: 8px;
    transition: color 0.2s ease;
}

.memo-icon:hover {
    color: #888888;
}

.memo-icon.active {
    color: #4b4dbd;
}

.diary-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.diary-modal-content {
    max-width: 500px;
}

.bible-icon {
    font-size: 0.95rem;
    color: #cccccc;
    cursor: pointer;
    margin-left: 8px;
    transition: color 0.2s ease;
}

.bible-icon:hover {
    color: #888888;
}

.bible-icon.completed {
    color: #ff9800;
    font-weight: bold;
}

.play-icon {
    margin-left: 5px;
    color: #cccccc;
    cursor: pointer;
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.play-icon:hover {
    color: #888888;
}

.play-icon.completed {
    color: #4CAF50;
}

.pattern-icon {
    margin-left: 5px;
    color: #cccccc;
    cursor: pointer;
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.pattern-icon:hover {
    color: #888888;
}

.pattern-icon.completed {
    color: #4F46E5 !important;
    font-weight: bold;
}

.routine-icon {
    margin-left: 5px;
    color: #cccccc;
    cursor: pointer;
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.routine-icon:hover {
    color: #FFA500;
}

.routine-icon.completed {
    color: #FFA500 !important;
    font-weight: bold;
}

.quiz-container {
    padding: 20px;
    background: #f9fafb;
    border-radius: 12px;
    text-align: center;
}

.quiz-question {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 20px;
}

.quiz-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.quiz-input:focus {
    border-color: #4F46E5;
}

.quiz-btn {
    background-color: #4F46E5;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
    width: 100%;
}

.quiz-btn:hover {
    background-color: #4338ca;
}

.quiz-feedback {
    margin-top: 15px;
    font-weight: bold;
    min-height: 24px;
}

.pattern-item-title {
    cursor: pointer;
    transition: color 0.2s;
}

.pattern-item-title:hover {
    color: #4338ca !important;
    text-decoration: underline;
}

.pattern-modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 90%;
}

.routine-modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 90%;
}

#nativeExprModal .modal-content {
    max-width: 1200px;
    width: 95%;
}

.native-expr-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.native-expr-list li {
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.native-expr-list li:hover {
    background-color: #f9f9f9;
}

.native-expr-list li.selected {
    background-color: #e6f7ff;
    border-left: 3px solid #0056b3;
}

.native-expr-list li .expr-date {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 2px;
}

.native-expr-list li .expr-title {
    font-weight: bold;
    color: #333;
    font-size: 0.95rem;
}

#nativeExprBtn:hover {
    background-color: #1a252f !important;
    transform: translateY(-50%) scale(1.05);
}

#memoSidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 350px;
    height: 100vh;
    background-color: white;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    transition: right 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}

#memoSidebar.show {
    right: 0;
}

.memo-sidebar-header {
    background-color: var(--primary-color);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.memo-sidebar-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.memo-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.memo-content-area {
    padding: 20px;
    flex-grow: 1;
    overflow-y: auto;
    font-size: 1rem;
    line-height: 1.6;
    white-space: pre-wrap;
    color: #333;
}

/* Exercise Feature */
.exercise-icon {
    font-size: 1rem;
    color: #ccc;
    cursor: pointer;
    margin-right: 5px;
    transition: color 0.3s;
}

.exercise-icon.completed {
    color: #3498db;
    font-weight: bold;
}

.running-icon {
    font-size: 1rem;
    color: #ccc;
    cursor: pointer;
    margin-right: 5px;
    transition: color 0.3s;
}

.running-icon.completed {
    color: #e74c3c;
    font-weight: bold;
}

.running-count {
    font-size: 0.75rem;
    color: #e74c3c;
    font-weight: bold;
    margin-left: 2px;
    vertical-align: middle;
}

.exercise-item-label {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1rem;
    cursor: pointer;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: background 0.2s;
}

.exercise-item-label:hover {
    background: #eef2f7;
}

.exercise-item-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #3498db;
}

.exercise-item-label span {
    color: #333;
    font-weight: 500;
}

/* Mobile View Buttons */
.view-mode-buttons {
    display: none;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.view-mode-btn {
    padding: 5px 15px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
}

.view-mode-btn.active {
    background: #2c3e50;
    color: white;
    border-color: #2c3e50;
}

.memo-empty-msg {
    color: #999;
    text-align: center;
    margin-top: 50%;
    font-style: italic;
}

/* Mobile Responsiveness */
@media screen and (max-width: 1024px) {
    .calendar-wrapper {
        padding: 5px;
        position: relative;
    }

    .view-mode-buttons {
        display: flex;
        width: 100%;
        /* Ensure buttons are centered */
    }

    .calendar-header {
        flex-direction: column;
        gap: 15px;
        padding-top: 15px;
    }

    .title-row {
        width: 100%;
        justify-content: space-between;
        /* Space out arrows and title on mobile */
        padding: 0 10px;
    }

    .calendar-header h2 {
        font-size: 1.5rem;
        /* Remove 'order' since structure handles it */
    }

    .nav-btn {
        width: 35px;
        height: 35px;
        /* Slightly smaller Nav buttons logic */
    }

    .native-expr-btn {
        position: static;
        /* Flow naturally */
        align-self: flex-start;
        /* Align Left */
        margin-left: 10px;
        font-size: 0.8rem;
        padding: 6px 12px;
        /* margin-top managed by gap */
    }

    /* Keep 7 columns, but shrink content */
    ul.days li {
        min-height: 80px;
        padding: 2px;
        font-size: 0.8rem;
    }

    /* View Mode Specifics */
    .calendar-body.view-day ul.days {
        display: block;
    }

    .calendar-body.view-day ul.days li {
        min-height: 50vh;
        /* Use viewport height ratio */
        padding: 20px;
        /* More padding */
    }

    /* Daily View: Large Date */
    .calendar-body.view-day ul.days li span {
        font-size: 2.5rem !important;
        margin-bottom: 20px;
        display: block;
    }

    /* Daily View: Large Icons */
    .calendar-body.view-day .icon-wrapper {
        gap: 15px !important;
        justify-content: center;
        /* Center icons at bottom */
        margin-top: auto;
        padding-bottom: 10px;
    }

    .calendar-body.view-day .icon-wrapper i {
        font-size: 2rem !important;
        /* Much larger icons */
        margin: 5px;
    }

    /* Daily View: Events bigger */
    .calendar-body.view-day .event-item {
        font-size: 1.1rem;
        padding: 8px;
        margin-top: 5px;
    }

    .calendar-body.view-week ul.weeks {
        display: none;
        /* Hide header in week view */
    }

    .calendar-body.view-week ul.days {
        grid-template-columns: repeat(3, 1fr);
        /* 3 Cols */
    }

    .calendar-body.view-week ul.days li {
        min-height: 120px;
    }

    /* Show label in week view */
    .calendar-body.view-week .mobile-day-label {
        display: inline-block !important;
        margin-left: 5px;
    }

    .memo-sidebar.open {
        width: 100%;
        right: 0;
    }

    .modal-content {
        max-width: 95%;
        margin: 10% auto;
    }

    .icon-wrapper i {
        font-size: 0.8rem;
        margin: 1px;
    }

    .events-wrapper {
        font-size: 0.7rem;
    }
}