/**
 * NanoNside - 공통 CSS
 * 디자인 가이드 기반 스타일 정의
 */

/* ========================================
   1. 기본 스타일
   ======================================== */

:root {
    /* Primary Colors */
    --color-primary: #f59e0b;
    --color-primary-hover: #d97706;
    --color-primary-light: #fef3c7;

    /* Neutral Colors */
    --color-sidebar-bg: #1f2937;
    --color-page-bg: #f9fafb;
    --color-card-bg: #ffffff;
    --color-text-primary: #374151;
    --color-text-secondary: #6b7280;
    --color-border: #e5e7eb;

    /* Status Colors */
    --color-success-bg: #d1fae5;
    --color-success-text: #065f46;
    --color-error-bg: #fee2e2;
    --color-error-text: #991b1b;
    --color-warning-bg: #fef3c7;
    --color-warning-text: #92400e;
    --color-info-bg: #dbeafe;
    --color-info-text: #1e40af;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--color-page-bg);
    color: var(--color-text-primary);
    line-height: 1.5;
}

/* ========================================
   2. 버튼 스타일
   ======================================== */

.btn-primary {
    background-color: var(--color-primary);
    color: white;
    font-weight: 500;
    padding: 0.5rem 1.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

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

.btn-secondary {
    background-color: #f3f4f6;
    color: var(--color-text-primary);
    font-weight: 500;
    padding: 0.5rem 1.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-secondary:hover {
    background-color: #e5e7eb;
}

.btn-outline {
    background-color: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
    font-weight: 500;
    padding: 0.5rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

.btn-danger {
    background-color: #ef4444;
    color: white;
    font-weight: 500;
    padding: 0.5rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-danger:hover {
    background-color: #dc2626;
}

/* 버튼 크기 */
.btn-sm {
    padding: 0.25rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

/* ========================================
   3. 입력 필드 스타일
   ======================================== */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="search"],
select,
textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: white;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
    outline: none;
}

input:disabled,
select:disabled,
textarea:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
}

input.error,
select.error,
textarea.error {
    border-color: #ef4444;
}

input.error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

input.success {
    border-color: #10b981;
}

/* Form Group */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-primary);
    margin-bottom: 0.5rem;
}

.form-label .required {
    color: #ef4444;
    margin-left: 0.25rem;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    margin-top: 0.25rem;
}

.form-error {
    font-size: 0.75rem;
    color: #ef4444;
    margin-top: 0.25rem;
}

/* Input with icon */
.input-group {
    position: relative;
}

.input-group-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-secondary);
}

.input-group input {
    padding-left: 2.75rem;
}

.input-group-append {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
}

/* ========================================
   4. 상태 뱃지
   ======================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-pending {
    background-color: #f3f4f6;
    color: #1f2937;
}

.badge-processing {
    background-color: var(--color-info-bg);
    color: var(--color-info-text);
}

.badge-completed {
    background-color: var(--color-success-bg);
    color: var(--color-success-text);
}

.badge-failed,
.badge-cancelled {
    background-color: var(--color-error-bg);
    color: var(--color-error-text);
}

/* ========================================
   5. 카드 스타일
   ======================================== */

.card {
    background-color: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}

.card-header {
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
}

.card-body {
    /* Default body styles */
}

.card-footer {
    border-top: 1px solid var(--color-border);
    padding-top: 1rem;
    margin-top: 1rem;
}

/* ========================================
   6. 테이블 스타일
   ======================================== */

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background-color: #f9fafb;
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-border);
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.875rem;
    color: var(--color-text-primary);
}

.table tr:hover {
    background-color: #f9fafb;
}

.table-responsive {
    overflow-x: auto;
}

/* ========================================
   7. 모달/팝업 스타일
   ======================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    backdrop-filter: blur(2px);
}

.modal-overlay.hidden {
    display: none !important;
}

.modal-content {
    background-color: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    padding: 0.5rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    background: none;
    border: none;
}

.modal-close:hover {
    color: #1f2937;
}

.modal-body {
    margin-bottom: 1rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

/* ========================================
   8. 페이지네이션
   ======================================== */

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 1.5rem;
}

.pagination-item {
    min-width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: var(--color-text-primary);
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s;
}

.pagination-item:hover:not(.disabled):not(.active) {
    background-color: #f3f4f6;
}

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

.pagination-item.disabled {
    color: #d1d5db;
    cursor: not-allowed;
}

/* ========================================
   9. 알림/토스트
   ======================================== */

.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 60;
    animation: slideIn 0.3s ease;
}

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

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

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

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

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast.fade-out {
    animation: slideOut 0.3s ease forwards;
}

/* ========================================
   10. 체크박스/라디오
   ======================================== */

.checkbox-group,
.radio-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group input[type="checkbox"],
.radio-group input[type="radio"] {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--color-primary);
}

.checkbox-label,
.radio-label {
    font-size: 0.875rem;
    color: var(--color-text-primary);
}

/* ========================================
   11. 아코디언 (FAQ용)
   ======================================== */

.accordion-item {
    border-bottom: 1px solid var(--color-border);
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    cursor: pointer;
    font-weight: 500;
}

.accordion-header:hover {
    color: var(--color-primary);
}

.accordion-icon {
    transition: transform 0.2s;
}

.accordion-item.open .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accordion-item.open .accordion-content {
    max-height: 500px;
}

.accordion-body {
    padding: 0 0 1rem 0;
    color: var(--color-text-secondary);
    line-height: 1.6;
}

/* ========================================
   12. 탭 네비게이션
   ======================================== */

.tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    gap: 0.5rem;
}

.tab-item {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab-item:hover {
    color: var(--color-primary);
}

.tab-item.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.tab-content {
    padding-top: 1rem;
}

.tab-pane {
    display: none;
}

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

/* ========================================
   13. 유틸리티 클래스
   ======================================== */

/* 숨김 */
.hidden { display: none !important; }

/* 텍스트 정렬 */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* 마진 */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }

/* 패딩 */
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }

/* Flex */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

/* 텍스트 색상 */
.text-primary { color: var(--color-primary); }
.text-success { color: var(--color-success-text); }
.text-error { color: var(--color-error-text); }
.text-warning { color: var(--color-warning-text); }
.text-muted { color: var(--color-text-secondary); }

/* 폰트 크기 */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }

/* 폰트 굵기 */
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ========================================
   14. 로딩 스피너
   ======================================== */

.spinner {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-lg {
    width: 2rem;
    height: 2rem;
    border-width: 3px;
}

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

/* ========================================
   15. 반응형
   ======================================== */

@media (max-width: 640px) {
    .card {
        padding: 1rem;
    }

    .modal-content {
        margin: 0.5rem;
        padding: 1rem;
    }

    .toast {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }
}

/* ========================================
   16. 드롭다운 메뉴
   ======================================== */

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    cursor: pointer;
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    min-width: 12rem;
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-0.5rem);
    transition: all 0.2s ease;
}

.dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 0.625rem 1rem;
    color: var(--color-text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: background-color 0.15s;
}

.dropdown-item:hover {
    background-color: #f3f4f6;
}

.dropdown-item:first-child {
    border-radius: 0.5rem 0.5rem 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 0.5rem 0.5rem;
}

.dropdown-divider {
    height: 1px;
    background-color: var(--color-border);
    margin: 0.25rem 0;
}

/* ========================================
   17. 비밀번호 강도 표시
   ======================================== */

.password-strength {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.password-strength-bar {
    flex: 1;
    height: 4px;
    background-color: #e5e7eb;
    border-radius: 2px;
}

.password-strength[data-strength="1"] .password-strength-bar:nth-child(1) {
    background-color: #ef4444;
}

.password-strength[data-strength="2"] .password-strength-bar:nth-child(-n+2) {
    background-color: #f59e0b;
}

.password-strength[data-strength="3"] .password-strength-bar:nth-child(-n+3) {
    background-color: #f59e0b;
}

.password-strength[data-strength="4"] .password-strength-bar:nth-child(-n+4) {
    background-color: #10b981;
}

.password-strength[data-strength="5"] .password-strength-bar {
    background-color: #10b981;
}

/* ========================================
   화면 중앙 알림 (말풍선 스타일)
   ======================================== */

.center-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    z-index: 10000;
    padding: 1rem 1.5rem;
    background-color: rgba(31, 41, 55, 0.9);
    color: white;
    border-radius: 2rem;
    font-size: 0.9375rem;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.center-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.center-toast.hide {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
}
