/* ==========================================================================
   1. Base & Global Styles
   ========================================================================== */
body {
    font-family: "맑은 고딕", Arial, sans-serif;
    margin: 20px;
    background: #f5f7fb;
    color: #333;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
}

h2 {
    margin-bottom: 15px;
}

canvas {
    max-width: 100%;
}

/* ==========================================================================
   2. Layout & Navigation
   ========================================================================== */
nav {
    text-align: center;
    margin-bottom: 20px;
}

nav a {
    display: inline-block;
    padding: 10px 15px;
    margin: 5px;
    background: #fff;
    border-radius: 12px;
    text-decoration: none;
    color: #333;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .1);
}

.section {
    background: #fff;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 15px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, .1);
}

/* ==========================================================================
   3. Start Screen & Menu Cards
   ========================================================================== */
.title-area {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.input-link {
    background: #fff;
    padding: 14px 18px;
    border-radius: 12px;
    text-decoration: none;
    color: #333;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .1);
    font-size: 16px;
}

.rainbow-link {
    text-decoration: none;
}

.menu-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 40px auto;
}

.menu-card {
    width: 220px;
    height: 160px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, .1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: #333;
    font-size: 26px;
    font-weight: bold;
    line-height: 1.5;
}

.menu-card:hover {
    transform: translateY(-5px);
    transition: .2s;
}

/* ==========================================================================
   4. Form & Inputs
   ========================================================================== */
input {
    padding: 12px;
    font-size: 16px;
    border-radius: 10px;
    border: 1px solid #ccc;
}

button {
    padding: 12px 8px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: #e7efff;
}

button:hover {
    opacity: .8;
}

.selected {
    background: #9fc5ff;
}

/* 행동 상태 버튼 */
.behavior-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 15px 0;
}

.behavior-btn {
    min-width: 0;
    flex: 1;
    white-space: nowrap;
}

.behavior-btn.selected {
    background: #9fc5ff;
}

.save {
    width: 100%;
    background: #d8f5d8;
    font-size: 18px;
}

/* ==========================================================================
   5. Calendar
   ========================================================================== */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.calendar-header button {
    padding: 10px 15px;
}

#calendar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.day-name {
    text-align: center;
    font-weight: bold;
    padding: 8px;
}

.calendar-day {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    min-height: 150px;
    padding: 8px;
    font-size: 11px;
    line-height: 1.4;
    overflow: hidden;
    word-break: break-word;
}

.calendar-day strong {
    display: block;
    font-size: 14px;
    margin-bottom: 5px;
}

.calendar-day div {
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-day div:first-of-type {
    height: 32px;
    /* 오전 2줄 */
    white-space: pre-line;
    overflow: hidden;
}

.calendar-day div:nth-of-type(3) {
    height: 32px;
    /* 오후 3줄 */
    white-space: pre-line;
    overflow: hidden;
}

.sunday strong {
    color: red;
}

.saturday strong {
    color: blue;
}

.holiday-text {
    color: red;
    font-weight: bold;
    text-align: center;
}

/* ==========================================================================
   6. Board & Tables
   ========================================================================== */
.table-wrap {
    width: 100%;
    overflow: hidden;
}

.difficult-table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    background: #fff;
}

.difficult-table th {
    background: #f1f3f8;
    padding: 12px;
    border-bottom: 1px solid #ddd;
    text-align: center;
}

.difficult-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    text-align: center;
}

.difficult-table tr:hover {
    background: #f8faff;
}

.difficult-table th:nth-child(2),
.difficult-table td:nth-child(2) {
    width: 35px;
    padding: 0;
    text-align: center;
    vertical-align: middle;
}

.difficult-content {
    cursor: pointer;
    text-align: left !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.difficult-content:hover {
    text-decoration: underline;
}

.level-warning {
    color: #d99b00;
    font-weight: bold;
}

.level-hard {
    color: red;
    font-weight: bold;
}

.edit-btn {
    background: #e7efff;
    padding: 8px 14px;
    font-size: 14px;
}

.delete-btn {
    background: #ffe5e5;
    padding: 8px 14px;
    font-size: 14px;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
}

.pagination button {
    padding: 8px 16px;
    font-size: 15px;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    background: #4caf50;
    color: white;
}

.pagination button:hover {
    background: #43a047;
}

.pagination button:disabled {
    background: #ccc;
    cursor: default;
}

#pageInfo {
    font-weight: bold;
    min-width: 60px;
    text-align: center;
}

/* ==========================================================================
   7. Information & Detail Boxes
   ========================================================================== */
.small-info {
    padding: 5px 10px;
}

.small-info h2 {
    margin: 0 0 3px 0;
    font-size: 16px;
}

.small-info p {
    margin: 0;
    font-size: 15px;
}

.content-box {
    min-height: 300px;
}

.content-box p {
    line-height: 1.7;
    white-space: pre-wrap;
}

.plan-box {
    max-width: 700px;
    margin: 20px auto;
    padding: 10px;
}

.plan-image {
    width: 100%;
    border-radius: 12px;
    display: block;
    border: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   8. Reports & Summary Components
   ========================================================================== */
.report-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.report-title h2 {
    margin: 0;
}

.report-link {
    display: inline-block;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 12px;
    color: #333;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .15);
    transition: 0.2s;
}

.report-link:hover {
    transform: translateY(-2px);
    opacity: .85;
}

.running-link {
    background: #cfefff;
}

.behavior-link {
    background: #d8f5d8;
}

.weight-link {
    background: #fff3cd;
}

.weight-link:hover {
    background: #ffe69c;
}

/* 월간 리포트 미니 달력 */
.behavior-summary {
    text-align: center;
    font-size: 17px;
    font-weight: bold;
    margin-bottom: 18px;
}

.mini-calendar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.mini-header {
    text-align: center;
    font-weight: bold;
    color: #666;
    font-size: 14px;
}

.mini-day {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    margin: 0 auto;
    background: #eee;
}

.mini-good {
    background: #4caf50;
}

.mini-normal {
    background: #ffc107;
}

.mini-hard {
    background: #f44336;
}

.mini-empty {
    background: transparent;
}

/* ==========================================================================
   9. Input Page PC Optimization
   ========================================================================== */
.input-page {
    max-width: 750px;
    margin: 0 auto;
}

.input-page .section {
    padding: 25px;
}

.input-page input {
    width: 100%;
    height: 50px;
    box-sizing: border-box;
    font-size: 18px;
}

.input-page textarea {
    width: 100%;
    height: 70px;
    box-sizing: border-box;
    padding: 15px;
    font-size: 17px;
    line-height: 1.6;
    border-radius: 10px;
    border: 1px solid #ccc;
    resize: none;
}

.input-page h1 {
    margin-top: 20px;
}

.input-page .behavior-buttons {
    display: flex;
    gap: 15px;
    width: 100%;
}

.input-page .behavior-btn {
    flex: 1;
    height: 55px;
    font-size: 18px;
    min-width: 0;
}

.input-page .save {
    height: 60px;
    font-size: 22px;
    font-weight: bold;
}

.record-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.record-row input[type="date"] {
    flex: 1;
    min-width: 0;
    font-size: 20px;
}

.record-row select {
    flex: 1;
    height: 45px;
    font-size: 18px;
}

.record-row .save {
    flex: 0.7;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.difficult-link {
    display: block;
    margin-top: 15px;
    padding: 12px;
    text-align: center;
    background: #f5f5f5;
    border-radius: 10px;
    text-decoration: none;
    color: #333;
    font-weight: bold;
}

/* ==========================================================================
   10. Media Queries (Responsive Design)
   ========================================================================== */
@media (max-width: 600px) {
    body {
        margin: 10px;
    }

    h1 {
        font-size: 24px;
    }

    nav a {
        padding: 8px;
        font-size: 14px;
    }

    .input-link {
        display: none;
    }

    .menu-container {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .menu-card {

        width: 75%;

        height: 90px;

        display: flex;

        align-items: center;

        justify-content: center;

        font-size: 20px;

        font-weight: bold;

        padding: 0 20px;

        margin: 0 auto;

    }

    .section {
        padding: 15px;
        border-radius: 12px;
    }

    .calendar-header h2 {
        font-size: 18px;
    }

    #calendar {
        grid-template-columns: repeat(5, 1fr);
        gap: 4px;
    }

    .calendar-day {
        min-height: 120px;
        font-size: 9px;
        padding: 4px;
    }

    .calendar-day strong {
        font-size: 12px;
    }

    .calendar-day div {
        margin-bottom: 2px;
    }


    .calendar-day div:first-of-type {
        height: 35px;
        /* 오전 2줄 */
        white-space: pre-line;
        overflow: hidden;
    }

    .calendar-day div:nth-of-type(3) {
        height: 35px;
        /* 오후 2줄 */
        white-space: pre-line;
        overflow: hidden;
    }

    /* Mobile Table */
    .difficult-table {
        width: 100%;
        table-layout: fixed;
        font-size: 13px;
    }

    .difficult-table th,
    .difficult-table td {
        padding: 6px 2px;
        text-align: center;
    }

    .difficult-table th:nth-child(1),
    .difficult-table td:nth-child(1) {
        width: 65px;
        white-space: nowrap;
        text-align: left;
        font-size: 12px;
    }

    .difficult-table th:nth-child(1) {
        text-align: center;
    }

    .difficult-table th:nth-child(2),
    .difficult-table td:nth-child(2) {
        width: 30px;
        padding: 0;
        text-align: center;
        vertical-align: middle;
    }

    .difficult-table th:nth-child(3),
    .difficult-table td:nth-child(3) {
        width: auto;
    }

    .difficult-table th:nth-child(4) {
        width: 90px;
        white-space: nowrap;
        text-align: center;
    }

    .difficult-table td:nth-child(4) {
        width: 90px;
        white-space: nowrap;
        text-align: right;
    }

    .difficult-content {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .difficult-table button {
        font-size: 13px;
        padding: 8px 10px;
        white-space: nowrap;
    }

    .edit-btn,
    .delete-btn {
        padding: 6px 8px;
        font-size: 11px;
    }

    .behavior-buttons {
        display: flex;
        gap: 10px;
    }

    .behavior-btn {
        flex: 1;
        height: 60px;
        font-size: 18px;
    }

    @media (max-width: 600px) {

        .record-row {
            gap: 5px;
        }

        .record-row input[type="date"] {
            flex: none;
            width: 145px;
            font-size: 17px;
        }

        .record-row select {
            width: 88px;
            font-size: 15px;
        }

        .record-row .save {
            width: 88px;
            font-size: 15px;
        }

    }

}


