/* 디자인 컨시스템 변수 */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --green: #059669;
    --green-bg: #d1fae5;
    --yellow: #d97706;
    --yellow-bg: #fef3c7;
    --red: #dc2626;
    --red-bg: #fee2e2;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #e5e7eb;
    /* 데스크탑에서 모바일 뷰 돋보이게 */
    display: flex;
    justify-content: center;
    color: var(--text-main);
    min-height: 100vh;
}

/* 모바일 뷰 컨테이너 */
#app {
    width: 100%;
    max-width: 480px;
    /* 아이폰 크기 시뮬레이션 */
    background: var(--bg-color);
    min-height: 100vh;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow-x: hidden;
    /* 가로 스크롤 방지 */
}

/* 헤더 공통 스타일 */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
}

header h1 {
    font-size: 1.25rem;
    font-weight: 700;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.icon-btn:hover {
    opacity: 0.7;
}

/* 뷰(화면) 전환 애니메이션 */
.view {
    display: none;
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding-bottom: 40px;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 대시보드 리스트 요소 */
.device-list {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.device-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 22px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.device-card:active {
    transform: scale(0.97);
}

.device-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

.device-info h2 {
    font-size: 1.15rem;
    margin-bottom: 6px;
    font-weight: 700;
}

.device-info p {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.d-day-badge {
    padding: 12px 18px;
    border-radius: 14px;
    font-weight: 800;
    font-size: 1.25rem;
    text-align: center;
    min-width: 80px;
}

.status-green {
    background: var(--green-bg);
    color: var(--green);
}

.status-yellow {
    background: var(--yellow-bg);
    color: var(--yellow);
}

.status-red {
    background: var(--red-bg);
    color: var(--red);
}

/* 상세 화면 상태 카드 */
.detail-content {
    padding: 20px;
}

.status-card {
    background: white;
    border-radius: 24px;
    padding: 40px 20px;
    text-align: center;
    margin-bottom: 24px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.status-card .circle {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2.25rem;
    font-weight: 800;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.5);
}

.status-card h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.status-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* 버튼 스타일 */
.btn-primary {
    width: 100%;
    padding: 18px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    width: 100%;
    padding: 18px;
    background: #e5e7eb;
    color: var(--text-main);
    border: none;
    border-radius: 16px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 히스토리 리스트 */
.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-main);
}

.history-list {
    list-style: none;
}

.history-list li {
    padding: 18px 20px;
    background: white;
    border-radius: 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
}

.history-list li::before {
    content: "🗓";
    margin-right: 12px;
    font-size: 1.1rem;
}

/* 폼(입력) 스타일 */
.form-content {
    padding: 20px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 16px;
    border: 2px solid transparent;
    background: white;
    border-radius: 14px;
    font-size: 1.05rem;
    font-family: inherit;
    transition: border-color 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.template-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    padding: 10px 14px;
    border-radius: 12px;
    background: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s;
}

.chip:active {
    transform: scale(0.96);
}

.chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* 모달 레이어 (팝업) */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal {
    background: white;
    border-radius: 24px;
    padding: 30px;
    width: 85%;
    max-width: 360px;
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-overlay.hidden .modal {
    transform: scale(0.9);
}

.modal h2 {
    margin-bottom: 12px;
    color: var(--text-main);
}

.modal p {
    color: var(--text-muted);
    margin-bottom: 28px;
    line-height: 1.6;
    font-size: 0.95rem;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.modal-actions button {
    margin-bottom: 0;
}