/* ============================================================
   모두시공 - UI 컴포넌트 CSS
   ============================================================ */

/* --- 카드 --- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 16px;
    transition: var(--transition);
}

.card:active {
    transform: scale(0.98);
}

.card-image {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    overflow: hidden;
    background: var(--bg);
}

.card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-image .card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-white);
}

.card-badge-green { background: var(--success); }
.card-badge-blue { background: var(--primary); }
.card-badge-orange { background: var(--accent); }

.card-favorite {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-favorite .material-icons-round {
    font-size: 20px;
    color: var(--danger);
}

.card-body {
    padding: 14px 16px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.card-meta-item {
    display: flex;
    align-items: center;
    gap: 3px;
}

.card-meta-item .material-icons-round {
    font-size: 14px;
}

/* --- 카드 리스트 (가로 스크롤) --- */
.card-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 0 16px 16px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.card-scroll .card {
    min-width: 280px;
    max-width: 300px;
    scroll-snap-align: start;
    margin-bottom: 0;
    flex-shrink: 0;
}

/* --- 상세 페이지 --- */
.detail-header {
    padding: 20px 16px;
}

.detail-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 16px;
}

.detail-info {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detail-info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-light);
}

.detail-info-item .material-icons-round {
    font-size: 18px;
    color: var(--primary);
}

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

.detail-content h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 12px;
}

.detail-content p {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-light);
}

.detail-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 8px 0;
}

/* --- 문의하기 버튼 (하단 고정) --- */
.btn-inquiry-fixed {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - 32px);
    margin: 20px 16px;
    padding: 16px;
    background: var(--primary);
    color: var(--text-white);
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.btn-inquiry-fixed:active {
    background: var(--primary-dark);
    transform: scale(0.98);
}

.btn-inquiry-fixed .material-icons-round {
    font-size: 20px;
}

/* --- 버튼 --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    line-height: 1;
}

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

.btn-primary:active {
    background: var(--primary-dark);
}

.btn-accent {
    background: var(--accent);
    color: var(--text-white);
}

.btn-accent:active {
    background: #d35400;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-danger {
    background: var(--danger);
    color: var(--text-white);
}

.btn-full {
    width: 100%;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
}

/* --- 상태 뱃지 --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
}

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

.badge-answered {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-closed {
    background: #f5f5f5;
    color: #757575;
}

/* --- 폼 --- */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    color: var(--text);
    background: var(--bg-white);
    transition: border-color 0.2s;
    outline: none;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(44, 62, 107, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.form-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: 4px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- 문의 리스트 아이템 --- */
.inquiry-item {
    display: block;
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s;
}

.inquiry-item:active {
    background: var(--bg);
}

.inquiry-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.inquiry-item-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
    margin-right: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.inquiry-item-preview {
    font-size: 13px;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
}

.inquiry-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

/* --- FAB 버튼 --- */
.fab {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom) + 16px);
    right: calc(50% - 240px + 16px);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    background: var(--accent);
    color: var(--text-white);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    font-weight: 600;
    z-index: 50;
    transition: var(--transition);
}

.fab:active {
    transform: scale(0.95);
}

.fab .material-icons-round {
    font-size: 20px;
}

@media (max-width: 480px) {
    .fab {
        right: 16px;
    }
}

/* --- 탭 --- */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-light);
    padding: 0 16px;
    background: var(--bg-white);
    position: sticky;
    top: var(--header-height);
    z-index: 10;
}

.tab {
    flex: 1;
    padding: 12px 8px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* --- 이미지 슬라이더 --- */
.image-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.image-slider-track {
    display: flex;
    transition: transform 0.3s ease;
}

.image-slider-slide {
    min-width: 100%;
    position: relative;
    padding-top: 56.25%;
}

.image-slider-slide img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-slider-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 12px 0;
}

.image-slider-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: var(--transition);
}

.image-slider-dot.active {
    background: var(--primary);
    width: 20px;
    border-radius: 4px;
}

/* --- 배너 (홈) --- */
.home-banner {
    position: relative;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius);
    margin: 16px;
    padding: 24px 20px;
    color: var(--text-white);
    overflow: hidden;
}

.home-banner::after {
    content: '';
    position: absolute;
    right: -20px;
    top: -20px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.home-banner-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 8px;
}

.home-banner-desc {
    font-size: 13px;
    opacity: 0.8;
    margin-bottom: 16px;
}

.home-banner-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-white);
    backdrop-filter: blur(10px);
}

/* --- 채팅 UI --- */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.5;
}

.chat-message-mine {
    align-self: flex-end;
    background: var(--primary);
    color: var(--text-white);
    border-bottom-right-radius: 4px;
}

.chat-message-other {
    align-self: flex-start;
    background: var(--bg);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

.chat-message-time {
    font-size: 11px;
    margin-top: 4px;
    opacity: 0.6;
}

.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-white);
}

.chat-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 14px;
    outline: none;
}

.chat-input:focus {
    border-color: var(--primary);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-send-btn .material-icons-round {
    font-size: 20px;
}

/* --- 모달 / 다이얼로그 --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: calc(100% - 48px);
    max-width: 360px;
    text-align: center;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
}

.modal-body {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 24px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-actions .btn {
    flex: 1;
}

/* --- 프로필 --- */
.profile-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    padding: 30px 20px;
    text-align: center;
    color: var(--text-white);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.profile-avatar .material-icons-round {
    font-size: 40px;
    color: var(--text-white);
}

.profile-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.profile-id {
    font-size: 13px;
    opacity: 0.7;
}

/* --- 메뉴 리스트 (마이페이지 등) --- */
.menu-list {
    padding: 8px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    transition: background 0.2s;
}

.menu-item:active {
    background: var(--bg);
}

.menu-item-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-item-icon .material-icons-round {
    font-size: 22px;
    color: var(--primary);
}

.menu-item-text {
    flex: 1;
}

.menu-item-text strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
}

.menu-item-text span {
    font-size: 12px;
    color: var(--text-muted);
}

.menu-item-arrow {
    color: var(--text-muted);
    font-size: 18px;
}

.menu-item-danger .menu-item-icon {
    background: #ffebee;
}

.menu-item-danger .menu-item-icon .material-icons-round {
    color: var(--danger);
}

.menu-item-danger strong {
    color: var(--danger);
}

/* --- 연락처 카드 (고객센터) --- */
.contact-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.contact-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.contact-card-icon .material-icons-round {
    font-size: 22px;
}

.contact-card-text {
    flex: 1;
}

.contact-card-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.contact-card-value {
    font-size: 15px;
    font-weight: 600;
}

/* --- 카테고리 선택 모달 --- */
.category-modal .modal {
    text-align: left;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
    cursor: pointer;
}

.category-item:hover, .category-item:active {
    background: var(--bg);
}

.category-item-icon {
    font-size: 24px;
}

.category-item-name {
    font-size: 15px;
    font-weight: 500;
}

/* --- 알림 카운트 --- */
.notification-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--danger);
    color: var(--text-white);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- 상담방 아이템 --- */
.room-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s;
}

.room-item:active {
    background: var(--bg);
}

.room-item-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.room-item-icon .material-icons-round {
    font-size: 24px;
    color: var(--primary);
}

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

.room-item-title {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-item-preview {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 4px;
}

.room-item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.room-item-time {
    font-size: 11px;
    color: var(--text-muted);
}

/* --- 정보 박스 --- */
.info-box {
    background: #e3f2fd;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: #1565c0;
    margin-bottom: 16px;
}

.info-box .material-icons-round {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* --- 로딩 스피너 --- */
.spinner {
    display: flex;
    justify-content: center;
    padding: 40px;
}

.spinner::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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