/* 전체 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Noto Sans KR', sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    padding-bottom: 50px;
}

h1, h2, h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

section {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 20px;
    margin-bottom: 30px;
}

/* GNB 영역 */
.gnb {
    background-color: #2c3e50;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.gnb h1 {
    color: white;
    margin: 0;
    font-size: 1.5rem;
}

.gnb h1 a {
    color: white;
    text-decoration: none;
}

.header-buttons {
    display: flex;
    align-items: center;
    gap: 15px;
}

.refresh-button, .login-button, .logout-button, .back-button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
    text-decoration: none;
    display: inline-block;
}

.login-button {
    background-color: #2ecc71;
}

.logout-button {
    background-color: #e74c3c;
    font-size: 0.8rem;
    padding: 4px 8px;
}

.admin-link {
    background-color: #f1c40f;
    color: #2c3e50;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    margin-right: 8px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid white;
}

.hidden {
    display: none !important;
}

.refresh-button:hover {
    background-color: #2980b9;
}

.refresh-button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

/* Main 영역 */
main {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

/* 정원사들 - 참여자 목록 */
.gardeners-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
}

.gardener {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
}

.gardener a {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease;
}

.gardener a:hover {
    transform: scale(1.05);
}

.gardener img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #3498db;
}

.gardener span {
    margin-top: 5px;
    font-size: 0.8rem;
    text-align: center;
    word-break: break-all;
}

/* 진행률 */
.progress-bar {
    height: 20px;
    background-color: #ecf0f1;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-fill {
    height: 100%;
    background-color: #2ecc71;
    border-radius: 10px;
    transition: width 0.5s ease-in-out;
}

/* 출석/미출석 */
.attendance-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
    text-align: center;
    flex-wrap: wrap;
    gap: 20px;
}

.attendance-stats div {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    min-width: 120px;
}

.attendance-stats h3 {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: #7f8c8d;
}

.attendance-stats p {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2c3e50;
}

/* 전체 출석부 섹션 */
.attendance-table-section {
    margin-top: 30px;
}

.attendance-summary {
    margin-bottom: 20px;
}

/* 출석부 범례 */
.attendance-legend {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-mark {
    display: inline-block;
    width: 20px;
    height: 20px;
    text-align: center;
    line-height: 20px;
}

/* 오늘의 출석부 */
.today-table {
    margin-top: 15px;
}

.today-row {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.today-cell {
    flex: 0 0 10%;
    min-width: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border: 1px solid #ecf0f1;
    border-radius: 4px;
    margin-right: 5px;
    margin-bottom: 5px;
}

.today-cell .emoji {
    font-size: 1.5rem;
    margin-top: 5px;
}

/* 오늘의 출석 현황 */
.today-attendance-section {
    margin-top: 20px;
}

#today-date {
    margin-bottom: 5px;
    font-weight: bold;
    color: #3498db;
}

.last-updated {
    text-align: center;
    font-size: 0.85rem;
    margin-bottom: 10px;
    color: #888;
    font-style: italic;
}

.gardeners-attendance {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
}

.gardener-attendance {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
}

.gardener-attendance a {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease;
}

.gardener-attendance a:hover {
    transform: scale(1.05);
}

.gardener-attendance img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e0e0e0;
}

.gardener-attendance.attended img {
    border-color: #2ecc71;
}

.gardener-attendance.absent img {
    border-color: #e74c3c;
}

.gardener-attendance .attendance-emoji {
    font-size: 1.5rem;
    margin-top: 5px;
}

.gardener-attendance span.name {
    margin-top: 5px;
    font-size: 0.8rem;
    text-align: center;
    word-break: break-all;
}

/* 출석부 옵션 */
.attendance-options {
    display: flex;
    justify-content: flex-end;
    margin: 10px 0;
}

/* 토글 스위치 */
.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    background-color: #ccc;
    border-radius: 20px;
    margin-right: 8px;
    transition: .4s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
}

input:checked + .toggle-slider {
    background-color: #3498db;
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 0.9rem;
    color: #555;
}

/* 출석부 테이블 */
.table-container {
    overflow-x: auto;
    margin-top: 15px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
    font-size: 0.9rem;
}

th, td {
    padding: 10px 8px;
    text-align: center;
    border: 1px solid #ddd;
    position: relative;
}

th {
    position: sticky;
    top: 0;
    background-color: #3498db;
    color: white;
    z-index: 1;
}

tbody tr:nth-child(even) {
    background-color: #f2f2f2;
}

tfoot {
    background-color: #ecf0f1;
    font-weight: bold;
}

.fixed-column {
    position: sticky;
    left: 0;
    background-color: white;
    z-index: 2;
}

thead .fixed-column {
    background-color: #3498db;
    z-index: 3;
}

tbody tr:nth-child(even) .fixed-column {
    background-color: #f2f2f2;
}

tfoot .fixed-column {
    background-color: #ecf0f1;
}

/* 사용자 및 출석 데이터 */
.user-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px;
    white-space: nowrap;
}

.user-cell img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.attendance-mark {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
}

.attendance-mark.attended {
    color: #2ecc71;
}

.attendance-mark.absent {
    color: #e74c3c;
}

.attendance-rate {
    font-weight: bold;
}

.user-rank {
    font-weight: bold;
    width: 30px;
    display: inline-block;
}

.date-header {
    font-size: 0.8rem;
    white-space: nowrap;
    padding: 8px 5px;
}

.date-cell {
    min-width: 28px;
}

.date-short {
    display: none;
}

@media (max-width: 1200px) {
    .date-full {
        display: none;
    }
    .date-short {
        display: inline;
    }
}

/* 차트 영역 */
.ranking-chart,
.attendance-chart,
.weekday-chart,
.hourly-chart {
    height: 300px;
    margin-top: 15px;
}

/* 일별 출석률 차트 */
.attendance-chart-section {
    margin-top: 20px;
}

.chart-container {
    width: 100%;
    height: 300px;
    margin: 15px 0;
    position: relative;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .attendance-stats {
        flex-direction: column;
        gap: 10px;
    }

    .today-cell {
        flex: 0 0 20%;
        min-width: 80px;
    }

    .gardener, .gardener-attendance {
        width: 70px;
    }

    .gardener img, .gardener-attendance img {
        width: 50px;
        height: 50px;
    }
    
    .table-container {
        max-height: 500px;
    }
    
    .user-cell {
        padding: 2px;
        gap: 4px;
    }
    
    .user-cell img {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .gnb {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .today-cell {
        flex: 0 0 33.33%;
    }

    .gardener, .gardener-attendance {
        width: 60px;
    }

    .gardener img, .gardener-attendance img {
        width: 40px;
        height: 40px;
    }
    
    .gardener-attendance .attendance-emoji {
        font-size: 1.2rem;
    }
    
    .attendance-mark {
        width: 20px;
        height: 20px;
        font-size: 0.8rem;
    }
    
    th, td {
        padding: 6px 4px;
    }
    
    .date-cell {
        min-width: 24px;
    }
}

/* 애니메이션 효과 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

section {
    animation: fadeIn 0.5s ease-in-out;
}

/* 툴팁 스타일 */
[title] {
    position: relative;
    cursor: pointer;
}

/* 로딩 애니메이션 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 알림 메시지 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    background-color: #2ecc71;
    color: white;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    animation: slideIn 0.3s ease-out, fadeOut 0.5s ease-in 2.5s forwards;
}

.notification.error {
    background-color: #e74c3c;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; visibility: hidden; }
}