/* 계약서 가격 표시 */
.originalPrice {
    margin-right: 8px;
    color: #444;
    text-decoration: line-through;
}
.salePrice {
    font-weight: 700;
}
/* PetKey - 심플하고 깔끔한 애완동물 관리 시스템 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* 심플한 색상 팔레트 */
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --white: #ffffff;
    --black: #000000;
    
    /* 그림자 */
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* 둥근 모서리 */
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-900);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    width: 100%;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 헤더 - 심플하게 */
header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 1rem;
    cursor: pointer;
}

nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

#auth-nav {
    margin-right: auto;
}

.nav-btn {
    background: var(--white);
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-btn:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.nav-btn i {
    font-size: 0.875rem;
}

/* 메인 콘텐츠 */
main {
    flex: 1;
    padding: 2rem;
    max-width: none;
    margin: 0;
    width: 100%;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* 페이지 헤더 */
.dashboard-header,
.page-header {
    margin-bottom: 2rem;
}

.dashboard-header h2,
.page-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.dashboard-subtitle,
.page-subtitle {
    color: var(--gray-600);
    font-size: 1rem;
}

/* 대시보드 카드 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    text-align: center;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.stat-icon i {
    font-size: 1.25rem;
    color: var(--white);
}

.stat-card h3 {
    color: var(--gray-600);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-card span {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
}

/* 최근 활동 섹션 제거 */

/* 워크플로우 */
.workflow-header {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
}

.workflow-header h2 {
    color: var(--gray-900);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.progress-bar {
    display: flex;
    gap: 0.5rem;
}

.progress-step {
    flex: 1;
    padding: 0.75rem;
    text-align: center;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-600);
}

.progress-step.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.progress-step.completed {
    background: var(--success);
    border-color: var(--success);
    color: var(--white);
}

#workflow-content {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
    min-height: 400px;
}

.workflow-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* 버튼 - 심플하게 */
.btn-primary, .btn-secondary, .btn-success, .btn-info, .btn-warning, .btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    transition: all 0.2s;
    min-width: 100px;
    justify-content: center;
}

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

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

.btn-secondary {
    background: var(--gray-600);
    color: var(--white);
}

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

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

.btn-success:hover {
    background: #059669;
}

.btn-info {
    background: #0891b2;
    color: var(--white);
}

.btn-info:hover {
    background: #0e7490;
}

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

.btn-warning:hover {
    background: #d97706;
}

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

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

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

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    min-width: 80px;
}

/* 개체 목록 */
#pets-grid {
    display: block;
}
.table-container {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: auto;
}

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

.table th, .table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-200);
    text-align: left;
    white-space: nowrap;
}

.table th {
    background: var(--gray-50);
    font-weight: 600;
}

.table tr:hover {
    background: #fafafa;
}

/* 정렬 가능한 헤더 표시 */
.table th.sortable { cursor: pointer; }
.table th.sortable .sort-indicator { margin-left: 6px; opacity: 0.7; font-size: 0.8em; }
.pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding: 12px;
}
.pagination button {
    padding: 6px 10px;
    border: 1px solid var(--gray-300);
    background: var(--white);
    border-radius: 6px;
    cursor: pointer;
}
.pagination .page-info { color: var(--gray-600); margin-right: 8px; }

.pet-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: all 0.2s;
}

.pet-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--gray-300);
}

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

.pet-card h3 {
    color: var(--gray-900);
    font-weight: 600;
    font-size: 1.125rem;
}

.pet-status {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 500;
}

.status-received {
    background: #dbeafe;
    color: #1e40af;
}

.status-contract {
    background: #fef3c7;
    color: #92400e;
}

.status-completed {
    background: #d1fae5;
    color: #065f46;
}

.pet-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: 1rem;
}

.pet-stages {
    margin: 1rem 0;
}

.stage-progress {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.stage-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.stage-dot.completed {
    background: var(--success);
    color: var(--white);
}

.pet-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1rem;
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: var(--white);
    margin: 5% auto;
    padding: 2rem;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.close {
    color: var(--gray-400);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: var(--gray-600);
}

/* 폼 스타일 */
.form-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--primary);
    color: var(--white);
    border-radius: var(--radius-lg);
}

.form-header h2 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.form-header p {
    font-size: 0.875rem;
    opacity: 0.9;
}

.form-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.form-section h3 {
    color: var(--gray-900);
    margin-bottom: 1rem;
    font-size: 1.125rem;
    font-weight: 600;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.form-field {
    display: flex;
    flex-direction: column;
}

.form-field label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
    font-size: 0.875rem;
}

.form-field input,
.form-field select,
.form-field textarea {
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: var(--white);
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--primary);
}

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

.form-field.full-width {
    grid-column: 1 / -1;
}

.field-warning {
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
    font-weight: 500;
}

.form-field input[readonly] {
    background-color: var(--gray-100);
    color: var(--gray-600);
}

.checkbox-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 0;
}

.checkbox-group input[type="radio"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

/* 계약서 미리보기용 체크박스(꽉 채워진 스타일) */
.checkbox {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 1px solid #000;
    margin-right: 6px;
    line-height: 14px;
    text-align: center;
    font-size: 12px;
}

.checkbox.checked {
    background: #000;
    color: transparent; /* 내부 문자(■)는 보이지 않게 처리 */
}

/* 설정 화면 */
.settings-section {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    margin-bottom: 2rem;
}

.settings-section h3 {
    color: var(--gray-900);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
    font-size: 1.125rem;
    font-weight: 600;
}

/* 어드민/인증 보조 스타일 */
.admin-badge {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    background: #111827;
    color: #fff;
    font-size: 0.7rem;
    margin-left: 0.35rem;
}

.pending-user {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.5rem;
}

.pending-user .actions { display: flex; gap: 0.5rem; }

.producer-form {
    background: var(--gray-50);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.producer-list {
    margin-top: 1rem;
}

.producer-item {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.settings-table-container { border: 1px solid var(--gray-200); border-radius: var(--radius-lg); overflow: auto; box-shadow: var(--shadow); background: var(--white); }
.settings-table { width: 100%; border-collapse: collapse; }
.settings-table th, .settings-table td { padding: 10px 12px; border-bottom: 1px solid var(--gray-200); text-align: left; white-space: nowrap; }
.settings-table th { background: var(--gray-50); font-weight: 600; }
.settings-pagination { display:flex; justify-content:flex-end; align-items:center; gap:8px; padding: 10px; }
.settings-pagination button { padding: 6px 10px; border: 1px solid var(--gray-300); background: var(--white); border-radius: 6px; cursor: pointer; }
.settings-pagination .page-info { color: var(--gray-600); margin-right: 8px; }

.producer-info {
    flex: 1;
}

.producer-info h5 {
    margin: 0 0 0.5rem 0;
    color: var(--gray-900);
    font-weight: 600;
}

.producer-info p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--gray-600);
}

.producer-actions {
    display: flex;
    gap: 0.5rem;
}

/* 미리보기 화면 */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
}

.preview-header h2 {
    color: var(--gray-900);
    font-weight: 600;
    font-size: 1.25rem;
}

.preview-actions {
    display: flex;
    gap: 1rem;
}

.preview-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    min-height: 600px;
}

/* 서명 패드 */
.signature-section {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    border: 2px dashed var(--gray-300);
}

.signature-pad {
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    cursor: crosshair;
    display: block;
    margin: 1rem auto;
    background: var(--white);
}

.signature-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.signature-preview {
    max-width: 200px;
    max-height: 100px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    margin: 0.5rem 0;
}

/* 에러 및 성공 메시지 */
.error {
    text-align: center;
    padding: 1.5rem;
    background: #fef2f2;
    color: #991b1b;
    border-radius: var(--radius);
    border: 1px solid #fecaca;
}

.success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    padding: 1rem;
    border-radius: var(--radius);
    margin: 1rem 0;
}

.form-field.error input,
.form-field.error select,
.form-field.error textarea {
    border-color: var(--danger);
}

.form-field .error-message {
    color: var(--danger);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* 인쇄 스타일 */
@media print {
    body * {
        visibility: hidden;
    }
    
    .preview-content, .preview-content * {
        visibility: visible;
    }
    
    .preview-content {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        padding: 0;
        margin: 0;
        box-shadow: none;
        border-radius: 0;
        border: none;
    }

    .preview-header {
        display: none !important;
    }
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    header {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 1.25rem;
    }
    
    nav {
        gap: 0.25rem;
    }
    
    .nav-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
    
    main {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .progress-bar {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .workflow-actions {
        flex-direction: column;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .checkbox-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    #pets-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 1rem;
        width: calc(100% - 2rem);
        padding: 1.5rem;
    }
    
    .preview-header {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .form-section {
        padding: 1rem;
    }
    
    .workflow-header {
        padding: 1rem;
    }
    
    #workflow-content {
        padding: 1rem;
    }
    
    .settings-section {
        padding: 1rem;
    }
}

/* 자동완성 스타일 */
.autocomplete-container {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow-md);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
    transition: background-color 0.2s ease;
}

.autocomplete-item:hover,
.autocomplete-item.highlighted {
    background-color: var(--gray-50);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item-name {
    font-weight: 500;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.autocomplete-item-details {
    font-size: 0.75rem;
    color: var(--gray-500);
    line-height: 1.4;
}

.autocomplete-container input:focus + .autocomplete-list {
    border-color: var(--primary);
}

/* 수의사 도장 이미지 스타일 */
.vet-stamp-container {
    position: relative;
}

.vet-stamp-image {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    width: auto;
    height: 20px;
    border: 1px solid #ddd;
    z-index: 1;
}

/* 폼 도움말 스타일 */
.form-help {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--gray-500);
    font-style: italic;
}

/* 의료 기록 아이템 스타일 */
.medical-record-item {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    position: relative;
}

.medical-record-item:last-child {
    margin-bottom: 0;
}

.medical-record-item::before {
    content: "진료 기록 #" attr(data-index);
    position: absolute;
    top: -0.5rem;
    left: 1rem;
    background: var(--white);
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--primary);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

.medical-record-readonly {
    background: var(--gray-25);
    border-color: var(--gray-300);
}

.medical-record-readonly::before {
    color: var(--gray-600);
    content: "진료 기록 #" attr(data-index) " (연동됨)";
}

/* 설정 저장/추가 버튼 여백 */
#add-auction-company-btn,
#add-producer-btn,
#save-company-btn,
#do-login-btn {
    margin-top: 30px;
}

/* 탭 버튼 스타일 */
.tabs-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tab-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-300);
    background: var(--white);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-600);
    transition: all 0.2s;
}

.tab-btn:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

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