/* public/css/style.css - 유니크 특허 현황 시스템 공통 스타일 */

/* Language Bar */
.lang-bar {
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    width: 100%;
    box-sizing: border-box;
    display: block;
    text-align: right;
    padding: 4px 2rem;
    font-size: 0.78rem;
    line-height: 1.6;
}
.lang-bar a {
    display: inline;
    color: #555;
    text-decoration: none;
    margin-left: 10px;
    font-weight: 400;
    transition: color 0.2s;
}
.lang-bar a:hover { color: #111; }
.lang-bar a.active { color: #111; font-weight: 600; }
.lang-bar span { display: inline; color: #ccc; margin-left: 10px; }

:root {
    --primary-color: #54B435;
    --heading-color: #0F172A;
    --text-color: #2F3B40;
    --bg-light: #EDFBE2;
    --bg-white: #FFFFFF;
    --border-color: #e5e7eb;
    --error-color: #ef4444;
    --success-color: #22c55e;
}

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

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-color);
    background-color: #f9fafb;
    line-height: 1.6;
}

/* 레이아웃 */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* 헤더 */
.header {
    width: 100%;
    box-sizing: border-box;
    background: var(--bg-white);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--heading-color);
    text-decoration: none;
}

.logo span {
    color: var(--primary-color);
}

/* 네비게이션 */
.nav-tabs {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* 메인 컨텐츠 */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

.page-title {
    text-align: center;
    margin-bottom: 3rem;
}

.page-title h1 {
    font-size: 2.5rem;
    color: var(--heading-color);
    margin-bottom: 0.5rem;
}

.page-title p {
    font-size: 1.125rem;
    color: var(--text-color);
}

/* 검색 섹션 */
.search-section {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group {
    flex: 1;
    min-width: 250px;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--heading-color);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(84, 180, 53, 0.1);
}

.form-hint {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* 버튼 */
.btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(84, 180, 53, 0.2);
}

.btn-primary:hover {
    background: #469b2d;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(84, 180, 53, 0.3);
}

.btn-primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.btn-info {
    background: #0891b2;
    border-color: #0891b2;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: 2px solid;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
}

.btn-info:hover {
    background: #0e7490;
    border-color: #0e7490;
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

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

/* 입력 그룹 및 고객번호 찾기 버튼 */
.input-group {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.customer-number-input {
    flex: 0 0 200px; /* 12자리 + 여유공간으로 고정 너비 */
    min-width: 200px;
}

.find-customer-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
    background: #6b7280;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.find-customer-btn:hover {
    background: #4b5563;
    transform: translateY(-1px);
}

.find-customer-btn:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .input-group {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .customer-number-input {
        flex: 1;
        min-width: auto;
    }
    
    .find-customer-btn {
        width: 100%;
    }
}

/* 결과 섹션 */
.results-section {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--bg-light);
}

.results-info {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-label {
    font-weight: 600;
    color: var(--heading-color);
}

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

.action-buttons {
    display: flex;
    gap: 1rem;
}

/* 테이블 */
.table-container {
    overflow-x: auto;
    margin-top: 1.5rem;
}

.patent-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

.patent-table thead {
    background: var(--bg-light);
}

.patent-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--heading-color);
    border-bottom: 2px solid var(--primary-color);
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: var(--bg-light);
}

.patent-table td {
    padding: 1rem;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    vertical-align: top;
}

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

/* 테이블 내 모든 텍스트에서 밑줄 제거 */
.patent-table td * {
    text-decoration: none !important;
    border-bottom: none !important;
}

/* 테이블 컬럼 특정 너비 설정 (발명자 컬럼 제거 후 인덱스 조정) */
.patent-table th:nth-child(10),  /* 해당 연차료 납부마감일 */
.patent-table td:nth-child(10) {
    min-width: 140px;
    width: 140px;
}

.patent-table th:nth-child(15),  /* 추납기간 */
.patent-table td:nth-child(15),
.patent-table th:nth-child(16),  /* 회복기간 */
.patent-table td:nth-child(16) {
    min-width: 140px;
    width: 140px;
}

.patent-table .applicant-name,
.patent-table .invention-title {
    text-decoration: none !important;
}

/* 텍스트 자연스러운 2줄 표시 */
.text-natural-2lines {
    line-height: 1.4;
    max-height: 2.8em; /* line-height * 2 */
    overflow: hidden;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    display: block;
    text-decoration: none !important;
}

/* 발명의 명칭 자연스러운 멀티라인 표시 */
.invention-title-natural {
    max-width: 500px;
    min-width: 300px;
    text-decoration: none !important;
    line-height: 1.4;
    word-wrap: break-word;
    word-break: break-word;
    vertical-align: top;
}

/* 출원인명 스타일 개선 */
.applicant-name-clean {
    text-decoration: none !important;
    line-height: 1.4;
    max-height: 2.8em;
    overflow: hidden;
    word-wrap: break-word;
    word-break: break-word;
}

/* 특허번호 자연스러운 줄바꿈 */
.patent-number {
    line-height: 1.3;
    max-height: 2.6em; /* line-height * 2 */
    overflow: hidden;
    word-break: break-all;
    hyphens: none;
    max-width: 120px;
    min-width: 100px;
}

.invention-title {
    max-width: 500px;
    min-width: 300px;
}

.applicant-name {
    max-width: 250px;
    min-width: 150px;
    text-decoration: none !important;
}

/* 페이지네이션 */
.pagination-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg-white);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.pagination-info {
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 500;
}

.pagination-controls {
    display: flex;
    gap: 0.25rem;
}

.pagination-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    color: var(--text-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 2.5rem;
}

.pagination-btn:hover:not(.disabled):not(.active) {
    background: #f3f4f6;
    border-color: var(--primary-color);
}

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

.pagination-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f9fafb;
    color: #9ca3af;
}

@media (max-width: 768px) {
    .pagination-container {
        gap: 0.5rem;
        text-align: center;
    }
    
    .pagination-controls {
        justify-content: center;
    }
    
    .pagination-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
        min-width: 2rem;
    }
}

/* 상태 배지 */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* 로딩 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

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

/* 빈 상태 */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #6b7280;
}

.empty-icon {
    font-size: 4rem;
    color: #d1d5db;
    margin-bottom: 1rem;
}

.empty-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--heading-color);
    margin-bottom: 0.5rem;
}

.empty-description {
    color: var(--text-color);
}

/* 에러 메시지 */
.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
}

/* 푸터 */
.footer {
    background: var(--heading-color);
    color: #e2e8f0;
    padding: 2rem 0;
    margin-top: 4rem;
}

.footer-content {
    text-align: center;
}

.footer-text {
    margin-bottom: 0.5rem;
}

.footer-contact {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
}

.footer-contact a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-contact a:hover {
    color: var(--primary-color);
}

/* 햄버거 메뉴 버튼 */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 101;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 3px;
    background: var(--heading-color);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 6px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -6px);
}

/* 반응형 */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .header-content {
        flex-direction: row;
        flex-wrap: wrap;
        position: relative;
    }

    .nav-tabs {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 0;
        background: var(--bg-white);
        box-shadow: 0 8px 20px rgba(0,0,0,0.1);
        border-top: 1px solid var(--border-color);
        margin-top: 0.5rem;
    }

    .nav-tabs.active {
        display: flex;
    }

    .nav-tabs .nav-link {
        padding: 0.875rem 1rem;
        border-bottom: 1px solid #f0f0f0;
        border-left: 3px solid transparent;
        width: 100%;
    }

    .nav-tabs .nav-link:hover,
    .nav-tabs .nav-link.active {
        border-left-color: var(--primary-color);
        border-bottom-color: #f0f0f0;
        background: var(--bg-light);
    }

    .nav-tabs .nav-link:last-child {
        border-bottom: none;
    }

    /* 검색 섹션 */
    .search-section {
        padding: 1.25rem;
    }

    .search-form {
        flex-direction: column;
    }

    .form-group {
        width: 100%;
        min-width: auto;
    }

    /* 결과 헤더 */
    .results-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .results-info {
        flex-direction: column;
        gap: 0.5rem;
    }

    .action-buttons {
        width: 100%;
        flex-wrap: wrap;
    }

    .action-buttons .btn {
        flex: 1;
        min-width: 0;
        padding: 0.6rem 1rem;
        font-size: 0.875rem;
        justify-content: center;
    }

    /* 테이블 가로 스크롤 */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1.25rem;
        padding: 0 1.25rem;
    }

    .patent-table {
        min-width: 800px;
    }

    .patent-table th,
    .patent-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }

    /* 페이지 타이틀 */
    .page-title {
        margin-bottom: 1.5rem;
    }

    .page-title h1 {
        font-size: 1.75rem;
    }

    .page-title p {
        font-size: 1rem;
    }

    /* 결과 섹션 */
    .results-section {
        padding: 1.25rem;
    }

    /* 푸터 */
    .footer-contact {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .header-content {
        padding: 1rem 0;
    }

    .logo {
        font-size: 1.25rem;
    }

    .search-section {
        padding: 1rem;
    }

    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.875rem;
    }

    .page-title h1 {
        font-size: 1.5rem;
    }

    .results-section {
        padding: 1rem;
    }

    .action-buttons {
        gap: 0.5rem;
    }

    .action-buttons .btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }
}

/* 파일 링크 스타일 (개선된 버전) */
.file-link {
    color: #0066cc;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #e0e0e0;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.file-link:hover {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-color: #90caf9;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.file-icon {
    font-size: 1rem;
}

/* 파일이 없는 경우 스타일 */
.no-file {
    color: #6b7280;
    font-style: italic;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* 유효하지 않은 파일 URL 스타일 */
.invalid-file {
    color: #dc3545;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    cursor: help;
    background-color: #fef2f2;
    border-radius: 0.375rem;
    border: 1px solid #fecaca;
}