/* 기본 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* 헤더 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #c62828, #d32f2f);
    color: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(198, 40, 40, 0.3);
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 12px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover, .btn-icon:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.btn-help {
    background: #1976d2;
    border: 2px solid rgba(255, 255, 255, 0.85);
    color: white;
    height: 50px;
    padding: 0 16px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.btn-help:hover, .btn-help:active {
    background: #1565c0;
    transform: scale(1.05);
}

@media (max-width: 480px) {
    .btn-help {
        height: 45px;
        padding: 0 10px;
        font-size: 0.85rem;
    }
}
/* 상황판 */
.status-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.status-card {
    background: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 5px solid #4caf50;
    transition: transform 0.2s ease;
}

.status-card:hover {
    transform: translateY(-2px);
}

.status-card.warning {
    border-left-color: #ff9800;
}

.status-card.danger {
    border-left-color: #f44336;
}

.status-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

.status-count {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #333;
}

/* 팀 목록 */
.teams-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.team-card {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.team-card.status-waiting {
    border-left: 6px solid #4caf50;
}

.team-card.status-active {
    border-left: 6px solid #2196f3;
}

.team-card.status-warning {
    border-left: 6px solid #ff9800;
    animation: pulse-warning 2s infinite;
}

.team-card.status-danger {
    border-left: 6px solid #f44336;
    animation: pulse-danger 1s infinite;
}

@keyframes pulse-warning {
    0%, 50%, 100% { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1); }
    25%, 75% { box-shadow: 0 4px 20px rgba(255, 152, 0, 0.4); }
}

@keyframes pulse-danger {
    0%, 50%, 100% { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1); }
    25%, 75% { box-shadow: 0 4px 20px rgba(244, 67, 54, 0.5); }
}

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

.team-info h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 5px;
}

.team-floor {
    font-size: 0.9rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 5px;
}

.team-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    color: #666;
}

.btn-small:hover, .btn-small:active {
    transform: scale(1.1);
}

.btn-edit:hover {
    background: #e3f2fd;
    color: #1976d2;
}

.btn-delete:hover {
    background: #ffebee;
    color: #d32f2f;
}

/* 타이머 게이지 */
.timer-display {
    text-align: center;
    margin-bottom: 20px;
}

.timer-text {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.timer-text.status-waiting { color: #4caf50; }
.timer-text.status-active { color: #2196f3; }
.timer-text.status-warning { color: #ff9800; }
.timer-text.status-danger { color: #f44336; }

.progress-ring {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
}

.progress-ring svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.progress-ring-circle {
    stroke: #e0e0e0;
    stroke-width: 8;
    fill: transparent;
    r: 52;
    cx: 60;
    cy: 60;
}

.progress-ring-progress {
    stroke: #4caf50;
    stroke-width: 8;
    fill: transparent;
    r: 52;
    cx: 60;
    cy: 60;
    stroke-dasharray: 326.72;
    stroke-dashoffset: 326.72;
    transition: stroke-dashoffset 1s ease-in-out, stroke 0.3s ease;
    stroke-linecap: round;
}

.progress-ring-progress.status-active { stroke: #2196f3; }
.progress-ring-progress.status-warning { stroke: #ff9800; }
.progress-ring-progress.status-danger { stroke: #f44336; }

.status-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.status-waiting {
    background: #e8f5e8;
    color: #2e7d32;
}

.status-badge.status-active {
    background: #e3f2fd;
    color: #1565c0;
}

.status-badge.status-warning {
    background: #fff3e0;
    color: #e65100;
}

.status-badge.status-danger {
    background: #ffebee;
    color: #c62828;
}

/* 제어 버튼 */
.team-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn {
    padding: 15px 25px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #4caf50, #66bb6a);
    color: white;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.btn-primary:hover, .btn-primary:active {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #ff9800, #ffb74d);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

.btn-warning:hover, .btn-warning:active {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 152, 0, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #f44336, #ef5350);
    color: white;
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

.btn-danger:hover, .btn-danger:active {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(244, 67, 54, 0.4);
}

.btn-secondary {
    background: #f5f5f5;
    color: #666;
    border: 2px solid #e0e0e0;
}

.btn-secondary:hover, .btn-secondary:active {
    background: #eeeeee;
    border-color: #bdbdbd;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* 빈 상태 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state p {
    font-size: 1.2rem;
    margin-bottom: 30px;
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 25px 0;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-close:hover {
    background: #f5f5f5;
    color: #333;
}

.modal-body {
    padding: 0 25px 25px;
}

.form-group, .setting-group {
    margin-bottom: 20px;
}

.form-group label, .setting-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input, .setting-group input[type="number"] {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus, .setting-group input[type="number"]:focus {
    outline: none;
    border-color: #2196f3;
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.toggle-switch input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 30px;
}

/* 토스트 알림 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #333;
    color: white;
    padding: 15px 20px;
    border-radius: 12px;
    z-index: 1001;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background: #4caf50;
}

.toast.warning {
    background: #ff9800;
}

.toast.error {
    background: #f44336;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .app-container {
        padding: 10px;
    }

    .header {
        padding: 15px;
        border-radius: 10px;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    .btn-icon {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }

    .teams-list {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .team-card {
        padding: 20px;
        border-radius: 15px;
    }

    .timer-text {
        font-size: 2rem;
    }

    .progress-ring {
        width: 100px;
        height: 100px;
    }

    .btn {
        padding: 12px 20px;
        font-size: 0.9rem;
        min-width: 100px;
    }

    .modal-content {
        width: 95%;
        margin: 20px;
    }

    .modal-actions {
        flex-direction: column;
    }

    .status-overview {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .status-card {
        padding: 15px;
    }

    .status-count {
        font-size: 1.5rem;
    }
}

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

    .team-controls {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

/* PWA 관련 스타일 */
@media (display-mode: standalone) {
    .app-container {
        padding-top: 40px;
    }
}

/* 장갑 착용을 고려한 터치 영역 확장 */
.btn, .btn-icon, .btn-small {
    min-height: 44px;
    min-width: 44px;
}

/* 다크모드 지원 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212;
        color: #e0e0e0;
    }

    .team-card, .modal-content, .status-card {
        background: #1e1e1e;
        color: #e0e0e0;
    }

    .form-group input, .setting-group input[type="number"] {
        background: #2c2c2c;
        border-color: #404040;
        color: #e0e0e0;
    }

    .btn-secondary {
        background: #2c2c2c;
        color: #e0e0e0;
        border-color: #404040;
    }
}

/* ===== 헤더 제목 + 소방 서비스 링크 ===== */
.header-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
}

.more-services-link {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    color: #c62828;
    font-size: 0.9rem;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.more-services-link:hover,
.more-services-link:active {
    background: #fff;
    transform: scale(1.03);
}

@media (max-width: 480px) {
    .header-title {
        justify-content: center;
    }
}

/* ===== 앱 소개 (접기/펼치기) ===== */
.about-section {
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 5px solid #c62828;
    margin-bottom: 30px;
    overflow: hidden;
}

.about-section summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 56px;
    padding: 14px 20px;
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    list-style: none;
}

.about-section summary::-webkit-details-marker {
    display: none;
}

.about-toggle {
    flex-shrink: 0;
    padding: 4px 12px;
    border-radius: 999px;
    background: #fdecea;
    color: #c62828;
    font-size: 0.85rem;
}

.about-toggle::after {
    content: '펼치기 ▼';
}

.about-section[open] .about-toggle::after {
    content: '접기 ▲';
}

.about-body {
    padding: 0 20px 20px;
}

.about-list {
    padding-left: 20px;
    margin-bottom: 16px;
}

.about-list li {
    margin-bottom: 6px;
}

.about-list b {
    color: #c62828;
}

.about-body img {
    display: block;
    width: 100%;
    border-radius: 12px;
}

@media (prefers-color-scheme: dark) {
    .about-section {
        background: #1e1e1e;
    }

    .about-list b {
        color: #ff6f60;
    }

    .about-toggle {
        background: rgba(198, 40, 40, 0.25);
        color: #ff8a80;
    }
}

/* ===== 사용법 안내 (음영 + 강조) ===== */
.tour {
    display: none;
}

.tour.show {
    display: block;
}

.tour-blocker {
    position: fixed;
    inset: 0;
    z-index: 3000;
}

.tour-hole {
    position: fixed;
    z-index: 3001;
    border-radius: 14px;
    border: 3px solid #ffd600;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.78), 0 0 18px rgba(255, 214, 0, 0.8);
    pointer-events: none;
    transition: top 0.25s ease, left 0.25s ease, width 0.25s ease, height 0.25s ease;
}

.tour-tip {
    position: fixed;
    z-index: 3002;
    padding: 16px;
    border-radius: 14px;
    background: #1a1a1a;
    border: 1px solid #444;
    color: #eee;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
    transition: top 0.25s ease, left 0.25s ease;
}

.tour-tip-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.tour-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.95rem;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.85);
}

.pill-red { background: linear-gradient(135deg, #b71c1c, #e53935); }
.pill-green { background: linear-gradient(135deg, #1b5e20, #43a047); }
.pill-orange { background: linear-gradient(135deg, #e65100, #fb8c00); }
.pill-blue { background: linear-gradient(135deg, #0d47a1, #1e88e5); }

.tour-step {
    font-size: 0.85rem;
    color: #999;
}

.tour-text {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 14px;
}

.tour-text b {
    color: #fff;
}

.tour-text .c-warn { color: #ffb74d; }
.tour-text .c-danger { color: #ff5252; }

.tour-ex {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 10px;
    border-radius: 6px;
    background: rgba(251, 140, 0, 0.2);
    color: #ffb74d;
    font-size: 0.9rem;
    font-weight: 700;
}

.tour-nav {
    display: flex;
    gap: 8px;
}

.tour-nav button {
    min-height: 44px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
}

.tour-skip {
    background: none;
    border: none;
    color: #999;
    padding: 0 6px;
    margin-right: auto;
}

.tour-prev {
    background: transparent;
    color: #ddd;
    border: 2px solid #555;
    padding: 0 16px;
}

.tour-next {
    background: linear-gradient(135deg, #b71c1c, #e53935);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.85);
    padding: 0 20px;
}
