/* ========================================
   크로바여행사 관리 시스템 - 메인 스타일시트
   ======================================== */

/* 기본 리셋 및 변수 */
:root {
    --primary-color: #2d9e5f;
    --primary-dark: #228b4d;
    --secondary-color: #1f7a47;
    --success-color: #48bb78;
    --danger-color: #f56565;
    --warning-color: #ed8936;
    --info-color: #4299e1;

    --gray-50: #f7fafc;
    --gray-100: #edf2f7;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e0;
    --gray-400: #a0aec0;
    --gray-500: #718096;
    --gray-600: #4a5568;
    --gray-700: #2d3748;
    --gray-800: #1a202c;
    --gray-900: #171923;

    --white: #ffffff;
    --black: #000000;

    --border-radius: 8px;
    --border-radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);

    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    color: var(--gray-800);
    line-height: 1.6;
}

/* 컨테이너 */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========================================
   헤더
   ======================================== */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    padding: 30px 0;
    box-shadow: var(--shadow-md);
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
    text-align: center;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    text-align: center;
    font-weight: 300;
}

/* ========================================
   메인 컨테이너
   ======================================== */
.main-container {
    padding: 30px 0;
}

.container>.tab-nav {
    background: var(--white);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.tab-content {
    background: var(--white);
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 30px;
    min-height: 500px;
}

/* ========================================
   탭 네비게이션
   ======================================== */
.tabs {
    display: flex;
    background: var(--white);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.tab-btn {
    flex: 1;
    padding: 18px 20px;
    background: var(--gray-50);
    border: none;
    border-right: 1px solid var(--gray-200);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-600);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
}

.tab-btn:last-child {
    border-right: none;
}

.tab-btn:hover {
    background: var(--gray-100);
    color: var(--primary-color);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--white);
}

/* ========================================
   탭 컨텐츠
   ======================================== */
.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.tab-pane.active {
    display: block;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   섹션 헤더
   ======================================== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--gray-200);
}

.section-header h2 {
    font-size: 1.8rem;
    color: var(--gray-800);
    font-weight: 700;
}

/* ========================================
   버튼
   ======================================== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-300);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover:not(:disabled) {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

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

.btn-success:hover:not(:disabled) {
    background: #38a169;
}

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

.btn-danger:hover:not(:disabled) {
    background: #e53e3e;
}

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

/* ========================================
   검색 바
   ======================================== */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ========================================
   필터 바
   ======================================== */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    padding: 14px 18px;
}

/* 날짜 범위 From~To */
.filter-date-range {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--white);
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    padding: 4px 12px;
    transition: var(--transition);
    flex-shrink: 0;
}

.filter-date-range:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-date-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-600);
    white-space: nowrap;
    padding-right: 4px;
    border-right: 1px solid var(--gray-300);
}

.filter-date-range .form-input {
    border: none;
    padding: 8px 4px;
    min-width: 120px;
    width: 120px;
    box-shadow: none;
    font-size: 0.9rem;
}

.filter-date-range .form-input:focus {
    box-shadow: none;
    border: none;
    outline: none;
}

.filter-date-sep {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-500);
    padding: 0 2px;
}

.filter-input {
    padding: 12px 16px;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    min-width: 150px;
}

.filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ========================================
   테이블
   ======================================== */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
}

.data-table thead {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
}

.data-table th {
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
}

.data-table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.95rem;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.empty-message {
    text-align: center !important;
    color: var(--gray-500);
    padding: 40px !important;
    font-style: italic;
}

/* 테이블 액션 버튼 */
.table-actions {
    display: flex;
    gap: 8px;
}

/* ========================================
   모달
   ======================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-large {
    max-width: 800px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 25px 30px;
    border-bottom: 2px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 2rem;
    color: var(--white);
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.modal-body {
    padding: 30px;
}

.modal-form {
    padding: 30px;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.95rem;
}

.required {
    color: var(--danger-color);
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

.input-with-btn {
    display: flex;
    gap: 10px;
}

.input-with-btn .form-input {
    flex: 1;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--gray-200);
}

/* ========================================
   로딩 스피너
   ======================================== */
.spinner-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

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

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ========================================
   Toast 알림
   ======================================== */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 16px 24px;
    border-radius: var(--border-radius);
    color: var(--white);
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
    pointer-events: none;
}

.toast.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

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

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

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

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

/* ========================================
   반응형 디자인 (모바일)
   ======================================== */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .header {
        padding: 15px 0;
    }

    .header h1 {
        font-size: 1.1rem;
        line-height: 1.3;
        word-break: keep-all;
    }

    .logo {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    .main-container {
        padding: 20px 0;
    }

    .tab-content {
        padding: 20px 15px;
    }

    /* 탭 네비게이션 */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 0;
    }

    .tab-btn {
        padding: 12px 10px;
        font-size: 0.8rem;
        min-width: 90px;
        flex: 0 0 auto;
        gap: 4px;
    }

    .tab-btn:first-child {
        border-radius: var(--border-radius-lg) 0 0 0;
    }

    .tab-btn:last-child {
        border-radius: 0 var(--border-radius-lg) 0 0;
    }

    /* 섹션 헤더 */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .section-header h2 {
        font-size: 1.4rem;
    }

    .section-header .btn {
        width: 100%;
        justify-content: center;
    }

    /* 검색/필터 바 */
    .search-bar,
    .filter-bar {
        flex-direction: column;
        padding: 12px;
    }

    .filter-date-range {
        width: 100%;
        gap: 4px;
        padding: 4px 8px;
    }

    .filter-date-range .form-input {
        min-width: 100px;
        width: 100px;
        font-size: 0.85rem;
    }

    .filter-date-label {
        font-size: 0.75rem;
    }

    .filter-date-sep {
        font-size: 0.9rem;
    }

    .search-bar .btn,
    .filter-bar .btn {
        width: 100%;
        justify-content: center;
    }

    .filter-input,
    .filter-bar select {
        width: 100%;
        min-width: auto;
    }

    /* 테이블 - 카드 뷰로 변경 */
    .table-wrapper {
        box-shadow: none;
    }

    /* 모바일에서 숨길 컬럼 */
    .hide-mobile {
        display: none !important;
    }

    .data-table thead {
        display: none;
    }

    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
    }

    .data-table tr {
        margin-bottom: 15px;
        border: 2px solid var(--gray-200);
        border-radius: var(--border-radius);
        box-shadow: var(--shadow-sm);
        background: var(--white);
    }

    .data-table td {
        padding: 12px 15px;
        border-bottom: 1px solid var(--gray-200);
        position: relative;
        padding-left: 45%;
        text-align: right;
    }

    .data-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        font-weight: 600;
        color: var(--gray-700);
        text-align: left;
    }

    .data-table td:last-child {
        border-bottom: none;
    }

    .table-actions {
        justify-content: flex-end;
        flex-wrap: wrap;
    }

    /* 모달 */
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-header {
        padding: 20px;
    }

    .modal-header h3 {
        font-size: 1.3rem;
    }

    .modal-body,
    .modal-form {
        padding: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
    }

    /* Toast */
    .toast {
        left: 15px;
        right: 15px;
        bottom: 15px;
        text-align: center;
    }

    /* 버튼 */
    .btn {
        padding: 10px 20px;
        font-size: 0.95rem;
    }
}

/* 태블릿 */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 0 25px;
    }

    .tab-content {
        padding: 25px;
    }

    .form-row {
        gap: 15px;
    }

    /* 태블릿에서는 hide-mobile 컬럼 표시 */
    .hide-mobile {
        display: table-cell !important;
    }
}

/* 데스크톱 추가 스타일 */
@media (min-width: 1025px) {
    .modal-content {
        max-width: 700px;
    }

    .modal-large {
        max-width: 900px;
    }

    /* 데스크톱에서는 hide-mobile 컬럼 표시 */
    .hide-mobile {
        display: table-cell !important;
    }
}