/* ==========================================================================
   당차(DANGCHA) 모던 UI 베이스 스타일
   ========================================================================== */
:root {
    --bg-main: #f4f7fb;       /* 쿨톤의 세련된 밝은 회색 배경 */
    --card-bg: #ffffff;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --primary: #4361ee;       /* 트렌디한 인디고 블루 */
    --primary-hover: #3a53d0;
    --success: #10b981;       /* 더 부드러운 에메랄드 그린 */
    --danger: #ef4444;        /* 채도가 높은 모던 레드 */
    --warning: #f59e0b;       /* 따뜻한 호박색 */
    --border-color: #e2e8f0;
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 25px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    --shadow-hover: 0 20px 30px -5px rgba(67, 97, 238, 0.15);
}

/* ========================================= */
/* 1. 기본 타이포그래피 및 레이아웃 */
/* ========================================= */
body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-dark);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    line-height: 1.6;
}

h1, h2, h3 { color: var(--text-dark); margin-top: 0; margin-bottom: 15px; font-weight: 700; letter-spacing: -0.5px; }
p, ul { margin-top: 0; margin-bottom: 15px; }
a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

.container {
    background-color: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 900px;
    margin-top: 20px;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

header { text-align: center; margin-bottom: 30px; padding-bottom: 20px; border-bottom: 2px dashed var(--border-color); }
header h1 { color: var(--primary); font-size: 2rem; margin-bottom: 5px; }
header p { color: var(--text-muted); font-size: 0.95rem; }

/* ========================================= */
/* 2. 대시보드 섹션 및 카드 컨테이너 */
/* ========================================= */
.user-dashboard-section, .owner-dashboard-section, .admin-dashboard-section {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: var(--radius-lg);
    margin-top: 30px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

/* 역할별 미세한 경계색 부여 */
.user-dashboard-section { border-top: 5px solid #38bdf8; }
.owner-dashboard-section { border-top: 5px solid var(--success); }
.admin-dashboard-section { border-top: 5px solid var(--text-muted); }

.user-dashboard-section:hover, .owner-dashboard-section:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ========================================= */
/* 3. 폼(Form) 및 입력창(Input) 개선 */
/* ========================================= */
form { display: flex; flex-direction: column; gap: 15px; }
label { font-weight: 600; color: var(--text-dark); font-size: 0.95rem; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="tel"], input[type="date"], input[type="datetime-local"], select, textarea {
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    background-color: #f8fafc;
    transition: all 0.2s;
    width: 100%;
    box-sizing: border-box;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.15);
}

/* ========================================= */
/* 4. 트렌디한 버튼(Button) 디자인 */
/* ========================================= */
button {
    font-family: inherit;
    background-color: var(--primary);
    color: #fff;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
    margin-top: 5px;
}

button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(67, 97, 238, 0.4);
}

button:active { transform: translateY(0); box-shadow: 0 2px 6px rgba(67, 97, 238, 0.3); }
button:disabled { background-color: #cbd5e1; cursor: not-allowed; box-shadow: none; transform: none; }

.button-success { background-color: var(--success); box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3); }
.button-success:hover { background-color: #059669; box-shadow: 0 6px 15px rgba(16, 185, 129, 0.4); }

.button-danger { background-color: var(--danger); box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3); }
.button-danger:hover { background-color: #dc2626; box-shadow: 0 6px 15px rgba(239, 68, 68, 0.4); }

.button-warning { background-color: var(--warning); color: #fff; box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3); }
.button-warning:hover { background-color: #d97706; box-shadow: 0 6px 15px rgba(245, 158, 11, 0.4); }

.logout-button { background-color: var(--text-muted); box-shadow: none; margin: 15px auto; display: block; width: fit-content; border-radius: 30px; padding: 10px 24px; }
.logout-button:hover { background-color: #475569; }

/* ========================================= */
/* 5. 태그, 리스트 및 테이블 개선 */
/* ========================================= */
.status-tag {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 30px;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.status-available { background-color: var(--success); }
.status-maintenance { background-color: var(--danger); }
.status-pending-approval { background-color: var(--text-muted); }
.status-in-progress { background-color: var(--primary); }

ul { list-style: none; padding: 0; }
ul li {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 20px;
    margin-bottom: 12px;
    border-radius: var(--radius-md);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}
th, td { padding: 16px; text-align: left; border-bottom: 1px solid var(--border-color); }
th { background-color: #f8fafc; font-weight: 700; color: var(--text-muted); font-size: 0.9rem; text-transform: uppercase; }
tr:last-child td { border-bottom: none; }
tr:hover td { background-color: #f1f5f9; }

/* ========================================= */
/* 6. 모달 (Modal) 및 AI 채팅창 (Glassmorphism 적용) */
/* ========================================= */
.modal {
    display: none; position: fixed; z-index: 9999; left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px); /* 뒷배경 블러 처리로 트렌디하게 */
    justify-content: center; align-items: center;
}
.modal-content {
    background-color: var(--card-bg);
    padding: 35px;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 90%; max-width: 500px;
    position: relative;
    animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes modalPop { 0% { opacity: 0; transform: scale(0.95) translateY(20px); } 100% { opacity: 1; transform: scale(1) translateY(0); } }

.close-button { position: absolute; top: 20px; right: 25px; font-size: 28px; color: var(--text-muted); cursor: pointer; transition: color 0.2s; }
.close-button:hover { color: var(--danger); }

/* AI 채팅창 */
.chat-container { border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 20px; background-color: var(--card-bg); box-shadow: var(--shadow-sm); }
.chat-messages { height: 350px; overflow-y: auto; padding: 15px; background-color: #f8fafc; border-radius: var(--radius-md); display: flex; flex-direction: column; gap: 12px; margin-bottom: 15px; }
.chat-message { padding: 12px 18px; border-radius: 20px; max-width: 80%; font-size: 0.95rem; line-height: 1.5; }
.chat-message.user { background-color: var(--primary); color: white; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-message.gemini { background-color: #e2e8f0; color: var(--text-dark); align-self: flex-start; border-bottom-left-radius: 4px; }
.chat-input-area { display: flex; gap: 10px; }
.chat-input-area textarea { border-radius: var(--radius-sm); min-height: 50px; }
.chat-input-area button { border-radius: var(--radius-sm); margin-top: 0; }

/* ========================================= */
/* 7. 스마트키 전용 모달 (다크 모드 유지) */
/* ========================================= */
.smart-key-modal-content { background-color: #1e293b; color: #fff; text-align: center; border: 1px solid #334155; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5); }
.smart-key-modal-content h2 { color: #fff; }
.smart-key-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 25px; }
.smart-key-button { width: 100%; height: auto; padding: 20px; border-radius: var(--radius-md); font-size: 1.1rem; }

/* 피드백 별점 스타일 */
.star-rating { display: flex; flex-direction: row-reverse; font-size: 2.5em; justify-content: center; gap: 10px; margin: 0 auto 20px; }
.star-rating input { display: none; }
.star-rating label { color: #cbd5e1; cursor: pointer; transition: color 0.2s, transform 0.2s; }
.star-rating :checked ~ label { color: var(--warning); }
.star-rating label:hover, .star-rating label:hover ~ label { color: #fbbf24; transform: scale(1.1); }

/* ========================================= */
/* 8. 모바일 반응형 최적화 */
/* ========================================= */
@media (max-width: 768px) {
    body { padding: 10px; background-color: var(--card-bg); } /* 모바일에서는 컨테이너와 배경색 일치 */
    .container { padding: 20px; margin-top: 0; border-radius: 0; border: none; box-shadow: none; }
    h1 { font-size: 1.6rem; }
    button { width: 100%; padding: 16px; font-size: 1.05rem; }
    table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; border: none; box-shadow: none; }
    ul li { flex-direction: column; align-items: stretch; padding: 15px; }
    .user-dashboard-section, .owner-dashboard-section, .admin-dashboard-section { padding: 20px 15px; }
    .smart-key-controls { grid-template-columns: 1fr; }
}



/* ==========================================================================
   🚀 모던 앱 UI 대개편 (유저 대시보드 메인 레이아웃)
   ========================================================================== */

/* 전체 래퍼 및 공통 설정 */
.app-dashboard-container { max-width: 768px; margin: 0 auto; padding: 20px 15px; font-family: 'Pretendard', sans-serif; }

/* 1. 상단 유틸리티 (비밀번호 변경 등) */
.util-bar { display: flex; justify-content: flex-end; margin-bottom: 25px; }
.btn-minimal { display: flex; align-items: center; gap: 6px; background: transparent; border: none; color: #64748b; font-size: 0.9rem; font-weight: 600; cursor: pointer; padding: 8px 12px; border-radius: 8px; transition: background 0.2s; }
.btn-minimal:hover { background: #f1f5f9; color: #0f172a; }

/* 2. 메인 CTA 카드 (앱 메인 배너 스타일) */
.hero-cta-card {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%); /* 다크 네이비톤 */
    border-radius: 20px;
    padding: 35px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.2);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s;
    margin-bottom: 40px;
}
.hero-cta-card:hover { transform: translateY(-4px); box-shadow: 0 20px 30px rgba(15, 23, 42, 0.3); }
.hero-content { display: flex; flex-direction: column; gap: 8px; }
.hero-title { margin: 0; font-size: 1.6rem; color: #ffffff; font-weight: 800; letter-spacing: -0.5px; }
.hero-subtitle { margin: 0; font-size: 0.95rem; color: #94a3b8; font-weight: 500; }
.hero-icon { width: 56px; height: 56px; border-radius: 50%; background: rgba(255, 255, 255, 0.1); color: #38bdf8; display: flex; justify-content: center; align-items: center; backdrop-filter: blur(8px); }

/* 3. 섹션 타이틀 (이모지 걷어낸 깔끔한 타이포) */
.section-title { margin: 0 0 20px 0; }
.section-title h3 { margin: 0; font-size: 1.4rem; font-weight: 800; color: #0f172a; letter-spacing: -0.5px; }

/* 4. 예약 현황 카드 (티켓/영수증 스타일 모던화) */
.booking-list-modern { display: flex; flex-direction: column; gap: 20px; }
.ticket-card { background: #ffffff; border-radius: 20px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05); overflow: hidden; border: 1px solid #f1f5f9; }

/* 티켓 헤더 (차량명 + 가격) */
.ticket-header { padding: 25px 20px; border-bottom: 2px dashed #e2e8f0; display: flex; justify-content: space-between; align-items: flex-start; }
.car-info-wrap { display: flex; flex-direction: column; gap: 4px; }
.car-name { margin: 0; font-size: 1.25rem; font-weight: 800; color: #1e293b; }
.car-spec { font-size: 0.85rem; color: #64748b; font-weight: 500; margin-bottom: 8px; }
.status-badge-modern { display: inline-block; width: fit-content; padding: 6px 12px; border-radius: 8px; font-size: 0.8rem; font-weight: 700; background: #eff6ff; color: #3b82f6; }
.status-badge-modern.badge-in_progress { background: #eff6ff; color: #2563eb; }
.status-badge-modern.badge-confirmed { background: #f0fdf4; color: #16a34a; }
.status-badge-modern.badge-pending { background: #f1f5f9; color: #64748b; }

.price-wrap { text-align: right; }
.price-amount { font-size: 1.4rem; font-weight: 800; color: #0f172a; }
.price-status { font-size: 0.85rem; color: #94a3b8; font-weight: 600; margin-top: 4px; }

/* 티켓 본문 (상세정보) */
.ticket-body { padding: 20px; background: #fafaf9; display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.info-item { display: flex; flex-direction: column; gap: 6px; }
.info-label { display: flex; align-items: center; gap: 4px; font-size: 0.8rem; color: #64748b; font-weight: 600; }
.info-value { font-size: 0.95rem; color: #334155; font-weight: 700; line-height: 1.4; }

/* 티켓 하단 (버튼 액션) */
.ticket-footer { padding: 15px 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; background: #ffffff; }
.btn-action-modern { padding: 14px 10px; border: none; border-radius: 12px; font-size: 0.95rem; font-weight: 700; cursor: pointer; text-align: center; transition: all 0.2s; }
.btn-action-modern.primary { background: #2563eb; color: #ffffff; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2); }
.btn-action-modern.primary:hover { background: #1d4ed8; }
.btn-action-modern.secondary { background: #f1f5f9; color: #475569; }
.btn-action-modern.secondary:hover { background: #e2e8f0; }
.btn-action-modern.danger { background: #fff1f2; color: #e11d48; }
.btn-action-modern.success { background: #ecfccb; color: #4d7c0f; }

/* 비어있을 때 상태 (Empty State) */
.empty-state { padding: 60px 20px; text-align: center; background: #f8fafc; border-radius: 20px; border: 1px dashed #cbd5e1; }
.empty-state svg { margin-bottom: 15px; }
.empty-state p { margin: 0; font-size: 1rem; color: #64748b; font-weight: 600; }

/* 모바일 뷰 최적화 */
@media screen and (max-width: 768px) {
    .ticket-body { grid-template-columns: 1fr; }
    .ticket-footer { display: flex; flex-direction: column; }
    .btn-action-modern { width: 100%; padding: 16px; }
}

/* 로그아웃 버튼 시인성 개선 (짙은 회색 배경 + 흰색 글자) */
.btn-logout-small, a.btn-logout-small {
    background-color: #475569 !important;
    color: #ffffff !important;
    text-decoration: none !important;
    font-weight: 700;
}
.btn-logout-small:hover, a.btn-logout-small:hover {
    background-color: #1e293b !important;
    color: #ffffff !important;
}