/* ============================
   정율사관학원 체크리스트 스타일
   ============================ */

:root {
    --primary: #1B3A5C;
    --primary-light: #2A5A8C;
    --primary-dark: #0F2640;
    --accent: #FF6B35;
    --accent-light: #FF8F63;
    --success: #10B981;
    --success-bg: #D1FAE5;
    --warning: #F59E0B;
    --warning-bg: #FEF3C7;
    --danger: #EF4444;
    --danger-bg: #FEE2E2;
    --bg: #F0F4F8;
    --card: #FFFFFF;
    --border: #E2E8F0;
    --text: #1E293B;
    --text-secondary: #64748B;
    --text-light: #94A3B8;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
}

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

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow-x: hidden;
    padding-bottom: 20px;
}

/* ===== HEADER ===== */
.app-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 16px 20px 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    backdrop-filter: blur(10px);
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.school-name {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.team-name {
    font-size: 11px;
    font-weight: 400;
    opacity: 0.85;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.15);
    padding: 6px 12px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.user-role {
    font-size: 11px;
    opacity: 0.9;
}

.user-name {
    font-size: 14px;
    font-weight: 700;
}

/* Date Display */
.date-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.date-nav-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.date-nav-btn:active {
    background: rgba(255,255,255,0.3);
}

.date-info {
    text-align: center;
    min-width: 180px;
}

.date-info .date-main {
    font-size: 16px;
    font-weight: 700;
}

.date-info .date-sub {
    font-size: 11px;
    opacity: 0.8;
}

.date-today-btn {
    background: var(--accent);
    border: none;
    color: white;
    padding: 4px 12px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Noto Sans KR', sans-serif;
    transition: all 0.2s;
}

.date-today-btn:active {
    transform: scale(0.95);
}

.date-today-btn.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ===== TABS ===== */
.tab-nav {
    display: flex;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 110px;
    z-index: 99;
    box-shadow: var(--shadow);
}

.tab-btn {
    flex: 1;
    padding: 12px 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-family: 'Noto Sans KR', sans-serif;
    color: var(--text-light);
    font-size: 12px;
    font-weight: 500;
    position: relative;
    transition: color 0.2s;
}

.tab-btn i {
    font-size: 16px;
}

.tab-btn.active {
    color: var(--primary);
    font-weight: 700;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 3px;
    background: var(--accent);
    border-radius: 3px 3px 0 0;
}

.tab-badge {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 10px;
    background: var(--bg);
    color: var(--text-secondary);
    font-weight: 600;
}

.tab-btn.active .tab-badge {
    background: var(--accent);
    color: white;
}

/* ===== PROGRESS ===== */
.progress-section {
    padding: 14px 20px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.progress-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.progress-percent {
    font-size: 14px;
    font-weight: 800;
    color: var(--primary);
}

.progress-bar {
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 4px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    padding: 12px 16px;
}

/* ===== GROUP ===== */
.checklist-group {
    margin-bottom: 16px;
}

.group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    margin-bottom: 6px;
}

.group-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: white;
    flex-shrink: 0;
}

.group-icon.gi-inquiry { background: #6366F1; }
.group-icon.gi-channel { background: #8B5CF6; }
.group-icon.gi-jandi { background: #10B981; }
.group-icon.gi-drive { background: #3B82F6; }
.group-icon.gi-jandi-drive { background: #14B8A6; }
.group-icon.gi-weekly { background: #F59E0B; }
.group-icon.gi-monthly { background: #EF4444; }

.group-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.group-count {
    font-size: 11px;
    color: var(--text-light);
    margin-left: auto;
}

/* ===== CHECKLIST ITEM ===== */
.checklist-item {
    background: var(--card);
    border-radius: var(--radius-sm);
    padding: 14px 14px;
    margin-bottom: 6px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

.checklist-item:active {
    transform: scale(0.99);
}

.checklist-item.checked {
    border-left-color: var(--success);
    background: linear-gradient(135deg, #F0FDF4 0%, #FFFFFF 100%);
}

.checklist-item.checked .item-title {
    color: var(--text-light);
    text-decoration: line-through;
    text-decoration-color: var(--success);
}

.checklist-item.checked .item-desc {
    color: var(--text-light);
}

/* Checkbox */
.item-checkbox {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1px;
}

.item-checkbox:hover {
    border-color: var(--primary-light);
}

.checklist-item.checked .item-checkbox {
    border-color: var(--success);
    background: var(--success);
    animation: checkPop 0.3s ease;
}

.checklist-item.checked .item-checkbox i {
    color: white;
    font-size: 12px;
}

@keyframes checkPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.item-content {
    flex: 1;
    min-width: 0;
}

.item-num {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 2px;
}

.item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    transition: all 0.3s;
}

.item-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 3px;
    line-height: 1.4;
    transition: all 0.3s;
}

.item-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.item-memo-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: var(--bg);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-light);
    font-size: 13px;
    transition: all 0.2s;
}

.item-memo-btn:active {
    background: var(--border);
}

.item-memo-btn.has-memo {
    background: var(--warning-bg);
    color: var(--warning);
}

.item-time {
    font-size: 10px;
    color: var(--text-light);
    text-align: center;
}

/* ===== LOADING ===== */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.loading-spinner i {
    font-size: 28px;
    color: var(--primary);
}

.loading-spinner.hidden {
    display: none;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-state i {
    font-size: 48px;
    color: var(--border);
    margin-bottom: 16px;
}

.empty-state p {
    color: var(--text-light);
    font-size: 14px;
}

/* ===== CELEBRATION ===== */
.celebration-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.celebration-overlay.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.celebration-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: 40px 30px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.4s ease;
    max-width: 320px;
    width: 100%;
}

.celebration-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: bounce 0.6s ease infinite alternate;
}

.celebration-content h2 {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 8px;
}

.celebration-content p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.celebration-close {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    padding: 12px 40px;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Noto Sans KR', sans-serif;
    transition: transform 0.2s;
}

.celebration-close:active {
    transform: scale(0.95);
}

@keyframes bounce {
    to { transform: translateY(-8px); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    display: none;
    align-items: flex-end;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-overlay.show {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 70vh;
    animation: slideUp 0.3s ease;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.modal-header h3 i {
    color: var(--warning);
    margin-right: 6px;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
}

.modal-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.memo-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.memo-textarea {
    width: 100%;
    min-height: 120px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 14px;
    resize: vertical;
    color: var(--text);
    transition: border-color 0.2s;
}

.memo-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
}

.btn-cancel, .btn-save {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Noto Sans KR', sans-serif;
    transition: all 0.2s;
}

.btn-cancel {
    background: var(--bg);
    color: var(--text-secondary);
}

.btn-save {
    background: var(--primary);
    color: white;
}

.btn-save:active {
    transform: scale(0.97);
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--primary-dark);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 600;
    z-index: 300;
    opacity: 0;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: var(--shadow-lg);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== RESPONSIVE ===== */
@media (min-width: 600px) {
    body {
        max-width: 500px;
        margin: 0 auto;
        box-shadow: 0 0 30px rgba(0,0,0,0.1);
        min-height: 100vh;
    }
}

@media (min-width: 768px) {
    .app-header {
        padding: 20px 24px 16px;
    }

    .main-content {
        padding: 16px 20px;
    }

    .checklist-item {
        padding: 16px;
    }
}

/* ===== ALL DONE STATE ===== */
.all-done-banner {
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
    margin-bottom: 16px;
    box-shadow: var(--shadow-md);
}

.all-done-banner i {
    font-size: 32px;
    margin-bottom: 8px;
    display: block;
}

.all-done-banner h3 {
    font-size: 16px;
    font-weight: 800;
}

.all-done-banner p {
    font-size: 13px;
    opacity: 0.9;
    margin-top: 4px;
}

/* ===== SYNC STATUS ===== */
.sync-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 12px;
    margin: 6px auto 4px;
    width: fit-content;
    transition: all 0.3s ease;
}

.sync-status.hidden {
    display: none;
}

.sync-status.syncing {
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.9);
}

.sync-status.synced {
    background: rgba(16,185,129,0.25);
    color: #6EE7B7;
}

.sync-status.offline {
    background: rgba(239,68,68,0.25);
    color: #FCA5A5;
}

.sync-status.error {
    background: rgba(245,158,11,0.25);
    color: #FCD34D;
}

.sync-status i {
    font-size: 10px;
}

/* ===== REFRESH BUTTON ===== */
.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.refresh-btn {
    width: 34px;
    height: 34px;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
}

.refresh-btn:active {
    background: rgba(255,255,255,0.3);
    transform: rotate(180deg);
}

/* Scroll smooth */
html {
    scroll-behavior: smooth;
}

/* Safe area for notch phones */
@supports (padding: max(0px)) {
    .app-header {
        padding-top: max(16px, env(safe-area-inset-top));
    }
    body {
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}
