* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #203e34;
    --primary-hover: #1a332b;
    --secondary-color: #4a5568;
    --success-color: #203e34;
    --danger-color: #e53e3e;
    --warning-color: #dd6b20;
    --light-bg: #f7fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: #f0f4f3;
    min-height: 100vh;
    color: var(--text-primary);
    -webkit-tap-highlight-color: transparent;
}

/* 헤더 */
.header {
    background: white;
    box-shadow: var(--shadow);
    padding: 20px 0;
    position: relative;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.header .logo {
    max-width: 250px;
    width: 100%;
    height: auto;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 400;
}

/* 메인 컨테이너 */
.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px 40px;
}

/* 고객 타입 선택 화면 */
.customer-type-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
}

.selection-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 60px 40px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 800px;
    width: 100%;
}

.selection-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.selection-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 50px;
}

.selection-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    margin-bottom: 40px;
}

.selection-btn {
    background: var(--light-bg);
    border: 3px solid var(--border-color);
    border-radius: 16px;
    padding: 40px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    font-family: 'Noto Sans KR', sans-serif;
}

.selection-btn:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.selection-btn:active {
    transform: translateY(-2px);
}

.new-customer-btn:hover {
    background: rgba(32, 62, 52, 0.05);
}

.returning-customer-btn:hover {
    background: rgba(32, 62, 52, 0.05);
}

.btn-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 36px;
}

.btn-text h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.btn-text p {
    font-size: 14px;
    color: var(--text-secondary);
}

.view-records-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Sans KR', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.view-records-btn:hover {
    background: #2d3748;
    transform: translateY(-2px);
}

.view-records-btn:active {
    transform: translateY(0);
}

/* 폼 헤더 */
.form-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.back-btn {
    background: var(--light-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Sans KR', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.back-btn:hover {
    background: white;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.back-btn:active {
    transform: scale(0.98);
}

.form-header .section-title {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}


/* 탭 네비게이션 */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: white;
    padding: 10px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Sans KR', sans-serif;
}

.tab-btn:active {
    transform: scale(0.98);
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow);
}

.tab-btn i {
    margin-right: 8px;
}

/* 탭 콘텐츠 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* 카드 */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
}

/* 섹션 타이틀 */
.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

/* 서브 섹션 타이틀 */
.sub-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin-top: 25px;
    margin-bottom: 15px;
    padding-left: 10px;
    border-left: 4px solid var(--primary-color);
}

/* 폼 스타일 */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Noto Sans KR', sans-serif;
    transition: all 0.3s ease;
    background: white;
}

.form-group select {
    cursor: pointer;
    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='%23718096' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(32, 62, 52, 0.1);
}

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

/* 체크박스 그리드 */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.checkbox-label:active {
    transform: scale(0.98);
}

.checkbox-label input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.checkbox-label:has(input:checked) {
    background: rgba(32, 62, 52, 0.1);
    border-color: var(--primary-color);
}

.checkbox-label span {
    font-size: 15px;
    font-weight: 500;
}

/* 라디오 그룹 */
.radio-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.radio-label {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.radio-label:active {
    transform: scale(0.98);
}

.radio-label input[type="radio"] {
    width: 22px;
    height: 22px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.radio-label:has(input:checked) {
    background: rgba(32, 62, 52, 0.1);
    border-color: var(--primary-color);
}

.radio-label span {
    font-size: 15px;
    font-weight: 500;
}

/* 단일 체크박스 */
.checkbox-single {
    margin-bottom: 30px;
}

.checkbox-single .checkbox-label {
    display: inline-flex;
    padding: 14px 20px;
}

/* 도움말 텍스트 */
.help-text {
    color: var(--text-secondary);
    font-size: 14px;
    font-style: italic;
    margin-bottom: 20px;
    padding: 10px;
    background: var(--light-bg);
    border-radius: 6px;
}

/* 폼 액션 버튼 */
.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

/* 버튼 스타일 */
.btn {
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Sans KR', sans-serif;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

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

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

.btn-secondary {
    background: var(--secondary-color);
    color: white;
    flex: 1;
}

.btn-secondary:hover {
    background: #2d3748;
}

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

.btn-success:hover {
    background: #2f855a;
}

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

.btn-danger:hover {
    background: #c53030;
}

/* 목록 헤더 */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.list-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-wrapper {
    display: flex;
    gap: 5px;
    align-items: center;
    position: relative;
}

.search-input {
    padding: 10px 16px;
    font-size: 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    min-width: 300px;
    font-family: 'Noto Sans KR', sans-serif;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-sm {
    padding: 10px 14px;
    font-size: 14px;
}

/* 레코드 컨테이너 */
#records-container {
    min-height: 300px;
}

.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 16px;
}

.loading i {
    font-size: 32px;
    margin-bottom: 10px;
    display: block;
}

.no-records {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.no-records i {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
    opacity: 0.5;
}

/* 레코드 카드 */
.record-card {
    background: var(--light-bg);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    overflow: hidden;
}

.record-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

.record-card-main {
    flex: 1;
    padding: 20px;
    cursor: pointer;
}

.record-actions {
    display: flex;
    flex-direction: column;
    border-left: 2px solid var(--border-color);
    background: white;
}

.btn-icon-action {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
}

.btn-icon-action:hover {
    background: var(--light-bg);
}

.btn-icon-action:active {
    transform: scale(0.95);
}

.btn-icon-action.edit-btn {
    border-bottom: 1px solid var(--border-color);
}

.btn-icon-action.edit-btn:hover {
    color: var(--primary-color);
}

.btn-icon-action.delete-btn:hover {
    color: var(--danger-color);
}

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

.record-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: 5px;
}

.customer-type-badge-small {
    background: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 5px;
}

.record-date {
    font-size: 14px;
    color: var(--text-secondary);
}

.record-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.record-info-item {
    display: flex;
    gap: 8px;
}

.record-info-label {
    font-weight: 600;
    color: var(--text-primary);
}

.record-info-value {
    color: var(--text-secondary);
}

/* 페이지네이션 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.pagination button {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    border: 2px solid var(--border-color);
    background: white;
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Sans KR', sans-serif;
}

.pagination button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

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

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

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

.modal-header h2 {
    color: var(--primary-color);
    font-size: 22px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--light-bg);
    color: var(--text-primary);
}

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

.modal-footer {
    padding: 20px 30px;
    border-top: 2px solid var(--border-color);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.detail-section {
    margin-bottom: 25px;
}

.detail-section h3 {
    color: var(--primary-color);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.detail-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 15px;
    margin-bottom: 10px;
}

.detail-label {
    font-weight: 600;
    color: var(--text-primary);
}

.detail-value {
    color: var(--text-secondary);
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.detail-tag {
    background: var(--primary-color);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.customer-type-badge {
    background: var(--primary-color);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    display: inline-block;
}

/* 토스트 알림 */
.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: white;
    padding: 16px 28px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    font-size: 15px;
    font-weight: 600;
    z-index: 2000;
    transition: all 0.3s ease;
    max-width: 90%;
}

.toast.show {
    bottom: 30px;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

/* 반응형 디자인 - 태블릿 */
@media (max-width: 1024px) {
    .selection-buttons {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .checkbox-grid,
    .radio-group {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .record-info {
        grid-template-columns: 1fr;
    }
}

/* 반응형 디자인 - 모바일 */
@media (max-width: 768px) {
    .header .logo {
        max-width: 200px;
    }
    
    .container {
        padding: 0 15px 30px;
        margin: 20px auto;
    }
    
    .selection-card {
        padding: 40px 20px;
    }
    
    .selection-title {
        font-size: 24px;
    }
    
    .selection-buttons {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .selection-btn {
        padding: 30px 20px;
    }
    
    .btn-icon {
        width: 60px;
        height: 60px;
        font-size: 28px;
    }
    
    .btn-text h3 {
        font-size: 20px;
    }
    
    .card {
        padding: 20px;
    }
    
    .form-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        font-size: 15px;
        padding: 12px 16px;
    }
    
    .checkbox-grid,
    .radio-group {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .list-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .list-actions {
        flex-direction: column;
    }
    
    .record-card {
        flex-direction: column;
    }
    
    .record-actions {
        flex-direction: row;
        border-left: none;
        border-top: 2px solid var(--border-color);
    }
    
    .btn-icon-action {
        padding: 12px 15px;
    }
    
    .btn-icon-action.edit-btn {
        border-bottom: none;
        border-right: 1px solid var(--border-color);
    }
    
    .search-wrapper {
        width: 100%;
    }
    
    .search-input {
        width: 100%;
        min-width: auto;
    }
    
    .detail-row {
        grid-template-columns: 1fr;
        gap: 5px;
    }
    
    .modal-content {
        margin: 0;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

/* 터치 디바이스 최적화 */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .checkbox-label,
    .radio-label,
    .tab-btn,
    .record-card {
        min-height: 48px;
        touch-action: manipulation;
    }
    
    input,
    textarea,
    select {
        font-size: 16px; /* iOS 자동 줌 방지 */
    }
}
