/* 은채·은유·은지 할일관리 & 용돈 프로그램 스타일시트 */
:root {
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    
    /* 상태 색상 */
    --color-done: #10b981;       /* 초록 */
    --color-not-done: #ef4444;   /* 빨강 */
    --color-auto: #f59e0b;       /* 금색 */
    --color-gray: #475569;       /* 회색 */
    
    --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --font-family: 'Outfit', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg-gradient);
    color: var(--text-primary);
    font-family: var(--font-family);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* 1. 로그인 화면 스타일 */
.login-body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 8dvh;
    background: var(--bg-gradient);
}

.login-container {
    width: 100%;
    max-width: 360px;
    padding: 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.login-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.8rem;
}

/* PIN 표시 원 */
.dots-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 2.2rem;
}

.dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--text-secondary);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.dot.active {
    background-color: var(--text-primary);
    border-color: var(--text-primary);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    transform: scale(1.15);
}

/* 진동 애니메이션 */
.shake-animation {
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    15%, 45%, 75% { transform: translateX(-10px); }
    30%, 60%, 90% { transform: translateX(10px); }
}

/* 키패드 */
.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    width: 100%;
    max-width: 280px;
    touch-action: none; /* 터치 제스처 줌 방지 */
}

.key-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    font-size: 1.6rem;
    font-weight: 400;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    transition: all 0.15s ease;
    backdrop-filter: blur(10px);
    touch-action: manipulation; /* 더블탭 줌 및 스크롤 지연 방지 */
    user-select: none;          /* 텍스트 선택 방지 */
}

.key-btn:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0.92);
}

.key-btn.special-key {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* 2. 공통 헤더/네비게이션 */
.main-header {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--card-border);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.9rem;
}

.btn-logout {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.3);
}

.main-content {
    flex: 1;
    padding: 1rem;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

/* 3. 일별 화면 (child/index.php) */
.date-navigator {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-premium);
}

.nav-arrow {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.2rem 0.6rem;
    border-radius: 50%;
    transition: all 0.2s;
}

.nav-arrow:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
}

.nav-arrow:disabled {
    color: var(--color-gray);
    cursor: not-allowed;
    opacity: 0.4;
}

.current-date-text {
    font-size: 1.1rem;
    font-weight: 600;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 1.5rem 0 0.8rem 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.task-list {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-premium);
    margin-bottom: 1.5rem;
}

/* 할일 카드 행 */
.task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--card-border);
    cursor: pointer;
    transition: all 0.2s;
}

.task-item:last-child {
    border-bottom: none;
}

.task-item:active:not(.readonly) {
    background: rgba(255, 255, 255, 0.03);
}

.task-item.readonly {
    cursor: default;
    opacity: 0.65;
}

.task-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.task-name {
    font-size: 1rem;
    font-weight: 600;
}

.task-price {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.task-status-box {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 2px solid var(--color-gray);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.1rem;
    transition: all 0.2s;
}

/* 상태별 스타일 */
.task-item.status-done .task-status-box {
    border-color: var(--color-done);
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--color-done);
}

.task-item.status-not_done .task-status-box {
    border-color: var(--color-not-done);
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--color-not-done);
}

.task-item.status-auto .task-status-box {
    border-color: var(--color-auto);
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--color-auto);
}

.task-item.status-no_result .task-status-box {
    border-color: #ffffff;
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

/* 읽기전용 알림 바 */
.readonly-alert-bar {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fcd34d;
    padding: 0.8rem;
    border-radius: 8px;
    text-align: center;
    font-size: 0.85rem;
    margin-bottom: 1.2rem;
}

/* 하단 요약 */
.summary-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 1.2rem;
    border-radius: 16px;
    text-align: center;
    margin-top: 2rem;
    box-shadow: var(--shadow-premium);
}

.estimated-allowance {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.estimated-allowance span {
    color: var(--color-auto);
    font-size: 1.4rem;
}

.btn-view-weekly {
    display: block;
    background: var(--primary);
    color: white;
    text-decoration: none;
    padding: 0.8rem;
    border-radius: 10px;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-view-weekly:hover {
    background: var(--primary-hover);
}

/* 시험 결과용 모달 스타일 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: #1e293b;
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    width: 100%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.7);
    transform: scale(0.9);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.modal-btn-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.modal-btn {
    width: 100%;
    padding: 0.8rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.modal-btn-done {
    background: var(--color-done);
    color: white;
}
.modal-btn-done:hover { background: #059669; }

.modal-btn-not-done {
    background: var(--color-not-done);
    color: white;
}
.modal-btn-not-done:hover { background: #dc2626; }

.modal-btn-clear {
    background: #475569;
    color: #f1f5f9;
}
.modal-btn-clear:hover { background: #334155; }

.modal-btn-close {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--card-border);
    margin-top: 0.5rem;
}
.modal-btn-close:hover { background: rgba(255, 255, 255, 0.05); }

/* 4. 주간 그리드 화면 (child/weekly.php) */
.weekly-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: var(--shadow-premium);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.table-wrapper {
    overflow-x: auto;
    width: 100%;
}

.weekly-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: center;
    min-width: 600px;
}

.weekly-table th, .weekly-table td {
    padding: 0.8rem;
    border-bottom: 1px solid var(--card-border);
    white-space: nowrap;
}

.weekly-table th {
    background: rgba(15, 23, 42, 0.4);
    font-weight: 600;
    color: var(--text-secondary);
}

/* 첫 번째 & 두 번째 열 Sticky 고정 (가로 스크롤 시 항목명과 단가 유지) */
.weekly-table .col-sticky-1 {
    position: sticky;
    left: 0;
    background: #1e293b;
    z-index: 10;
    text-align: left;
    border-right: 1px solid var(--card-border);
}

.weekly-table .col-sticky-2 {
    position: sticky;
    left: 100px; /* 항목명 너비에 맞게 조절 필요 */
    background: #1e293b;
    z-index: 10;
    border-right: 1px solid var(--card-border);
}

/* 오늘 날짜 열 하이라이트 */
.weekly-table .col-today {
    background: rgba(99, 102, 241, 0.15);
    font-weight: bold;
}

/* 셀 상태 이모지/색상 매칭 */
.cell-status-done {
    color: var(--color-done);
    font-weight: bold;
}

.cell-status-not_done {
    color: var(--color-not-done);
    font-weight: bold;
}

.cell-status-auto {
    color: var(--color-auto);
}

.cell-bingo-yes {
    color: var(--color-auto);
    animation: bounce 1s infinite alternate;
}

/* 5. 관리자 대시보드 */
.admin-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .admin-card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.admin-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-premium);
    transition: transform 0.2s;
}

.admin-card:hover {
    transform: translateY(-4px);
}

.admin-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.5rem;
}

.admin-menu-list {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.admin-menu-link {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.admin-menu-link:hover, .admin-menu-link.active {
    background: var(--primary);
    border-color: var(--primary);
}

/* 통계 & 관리자 테이블 리스트 */
.admin-table-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1rem;
    box-shadow: var(--shadow-premium);
    overflow-x: auto;
}

.admin-form-group {
    margin-bottom: 1.2rem;
}

.admin-form-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.admin-form-control {
    width: 100%;
    background: #0f172a;
    border: 1px solid var(--card-border);
    color: white;
    padding: 0.8rem;
    border-radius: 8px;
    font-family: inherit;
}

.btn-admin-submit {
    background: var(--primary);
    border: none;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.btn-admin-submit:hover {
    background: var(--primary-hover);
}

/* 통계 차트 컨테이너 */
.chart-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: var(--shadow-premium);
}
