/* 공통 스타일 - Signly 전자계약 서비스 */

/* CSS 변수 정의 */
:root {
    /* 컬러 팔레트 */
    --primary-color: #2d4a3f;
    --primary-hover: #1a2e27;

    /* Bootstrap 변수 오버라이드 */
    --bs-primary: #2d4a3f !important;
    --bs-primary-rgb: 45, 74, 63 !important;
    --bs-primary-hover: #1a2e27 !important;
    --secondary-color: #64748b;
    --success-color: #059669;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --info-color: #0891b2;

    /* 그레이 스케일 - 포레스트 그린 테마 */
    --gray-50: #f4f6f5;
    --gray-100: #e8ebe9;
    --gray-200: #d1d7d3;
    --gray-300: #a8b5ad;
    --gray-400: #7a9287;
    --gray-500: #5a7368;
    --gray-600: #3d5a4f;
    --gray-700: #2f4840;
    --gray-800: #2d4a3f;
    --gray-900: #1a2e27;

    /* 레이아웃 */
    --header-height: 64px;
    --sidebar-width: 280px;
    --border-radius: 10px;
    --border-radius-lg: 16px;
    --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.08);
    --box-shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
    --font-tracking: -0.015em;

    /* 폰트 */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
}

/* 기본 리셋 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 전역 배경 - 미묘한 그라디언트 및 텍스처 */
body {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    background-attachment: fixed;
    min-height: 100vh;
    overflow-y: scroll;
    /* 스크롤바 영역 항상 확보 */
    letter-spacing: var(--font-tracking);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 스크롤바 스타일 커스터마이징 */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.7);
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* Firefox 스크롤바 */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.5) rgba(255, 255, 255, 0.1);
}

/* 투명 네비게이션 바 */
.navbar {
    background: transparent !important;
    box-shadow: none;
}

.navbar .navbar-brand {
    color: #2d4a3f !important;
}

.navbar .nav-link {
    color: #4b5563 !important;
}

.navbar .nav-link {
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    transition: all 0.3s ease;
}

.navbar .nav-link:hover {
    color: #1a2e27 !important;
    border-color: #3d5a4f;
    background: rgba(61, 90, 79, 0.1);
}

.navbar .nav-link.active {
    color: #1a2e27 !important;
    font-weight: 600;
    border-color: #3d5a4f;
    background: rgba(61, 90, 79, 0.15);
}

/* 메인 컨테이너 카드 스타일 */
.main-content-card {
    background: #fafafa;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

/* 로고 스타일 */
.navbar-brand {
    font-family: 'Lobster', cursive;
    font-size: 2.5rem;
    font-weight: 400;
    letter-spacing: 0.5px;
}

/* 기본 리셋 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans', Ubuntu, Cantarell, sans-serif;
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--gray-800);
}

/* 링크 기본 스타일 */
a {
    color: var(--bs-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--bs-primary-hover);
}

/* Nav Pills 스타일 커스터마이징 */
.nav-pills .nav-link {
    color: #64748b;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.nav-pills .nav-link:hover {
    background-color: rgba(102, 126, 234, 0.05);
    color: var(--primary-color);
}

.nav-pills .nav-link.active {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    font-weight: 500;
}

/* 버튼 공통 스타일 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.25rem;
    font-size: var(--font-size-sm);
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 40px;
    letter-spacing: var(--font-tracking);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), 0.1);
}

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

/* 버튼 변형 */
.btn-primary {
    background-color: var(--bs-primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--bs-primary-hover);
    color: white;
}

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

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

.btn-outline {
    background-color: transparent;
    border-color: var(--bs-primary);
    color: var(--bs-primary);
}

.btn-outline:hover:not(:disabled) {
    background-color: var(--bs-primary);
    color: white;
}

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

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

/* 버튼 크기 */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: var(--font-size-xs);
    min-height: 32px;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: var(--font-size-lg);
    min-height: 44px;
}

/* 폼 요소 */
.form-group {
    margin-bottom: 1rem;
}

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

.form-control {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: var(--font-size-base);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    background-color: white;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.form-control:focus {
    outline: none;
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), 0.1);
}

.form-control.is-invalid {
    border-color: var(--danger-color);
}

.form-control.is-invalid:focus {
    border-color: var(--danger-color);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.invalid-feedback {
    display: block;
    color: var(--danger-color);
    font-size: var(--font-size-sm);
    margin-top: 0.25rem;
}

/* 텍스트 영역 */
.form-control.textarea {
    min-height: 100px;
    resize: vertical;
}

/* 서명 영역 공통 스타일 */
.signature-section {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.signature-block {
    flex: 1;
}

.signature-line {
    margin: 8px 0;
}

.signature-line--seal {
    position: relative;
    min-height: 90px;
    white-space: nowrap;
    font-weight: normal;
}

.signature-stamp-label {
    margin-left: 8px;
    position: relative;
    display: inline-block;
    z-index: 1;
    text-decoration: none;
    border-bottom: none;
}

.signature-stamp-label .contract-variable-underline,
.signature-stamp-wrapper .contract-variable-underline {
    border-bottom: none !important;
    padding: 0;
    min-width: auto;
}

.signature-stamp-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.signature-stamp-wrapper img {
    max-width: 100%;
    max-height: 100%;
    opacity: 0.9;
}

.signature-stamp-image-element {
    display: block;
    max-width: 100%;
    max-height: 100%;
}

/* 헤더 레이아웃 */
.header {
    background-color: white;
    border-bottom: 1px solid var(--gray-200);
    height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.header-logo {
    display: flex;
    align-items: center;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--gray-900);
}

.logo-img {
    height: 32px;
    width: auto;
    margin-right: 0.5rem;
}

.logo-text {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--bs-primary);
}

.header-nav .nav-list {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 1rem;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    color: var(--gray-600);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
    gap: 0.5rem;
}

.nav-link:hover {
    color: var(--bs-primary);
    background-color: var(--gray-50);
}

.nav-link i {
    font-size: var(--font-size-base);
}

.dropdown-toggle::after {
    margin-left: 0.5rem;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
    min-width: 200px;
    padding: 0.5rem 0;
    display: none;
    z-index: 1000;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    color: var(--gray-700);
    text-decoration: none;
    gap: 0.5rem;
}

.dropdown-item:hover {
    background-color: var(--gray-50);
    color: var(--bs-primary);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--gray-200);
    margin: 0.5rem 0;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 3px;
    padding: 0.5rem;
}

.hamburger-line {
    width: 20px;
    height: 2px;
    background-color: var(--gray-600);
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    .header-nav {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .header-nav.mobile-open {
        display: block;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: white;
        border-bottom: 1px solid var(--gray-200);
        padding: 1rem;
    }

    .header-nav.mobile-open .nav-list {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .nav-link {
        padding: 0.75rem;
        border-radius: var(--border-radius);
    }

    .dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        padding-left: 1rem;
    }
}

.icon-contracts::before {
    content: "📋";
}

.icon-templates::before {
    content: "📝";
}

.icon-user::before {
    content: "👤";
}

.icon-profile::before {
    content: "👤";
}

.icon-settings::before {
    content: "⚙️";
}

.icon-logout::before {
    content: "🚪";
}

.icon-chevron-down::before {
    content: "▼";
}

/* 푸터 레이아웃 */
.footer {
    background-color: var(--gray-900);
    color: var(--gray-300);
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1rem 0;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 2rem;
    padding-bottom: 2rem;
}

.footer-section {
    display: flex;
    flex-direction: column;
}

.footer-logo {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.footer-logo-img {
    height: 28px;
    width: auto;
    margin-right: 0.5rem;
    filter: brightness(0) invert(1);
}

.footer-logo-text {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: white;
}

.footer-description {
    color: var(--gray-400);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.footer-social {
    display: flex;
    gap: 0.5rem;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: var(--gray-800);
    border-radius: 50%;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.social-link:hover {
    background-color: var(--bs-primary);
}

.footer-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: white;
    margin-bottom: 1rem;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-link {
    color: var(--gray-400);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid var(--gray-800);
    padding: 1.5rem 0;
}

.footer-bottom-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.copyright {
    color: var(--gray-500);
    margin: 0;
}

.footer-bottom-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.footer-bottom-link {
    color: var(--gray-500);
    text-decoration: none;
    font-size: var(--font-size-sm);
    transition: color 0.2s ease;
}

.footer-bottom-link:hover {
    color: var(--gray-300);
}

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

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-bottom-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-bottom-links {
        justify-content: center;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .footer-content {
        grid-template-columns: 2fr 1fr 1fr;
    }

    .footer-section:last-child {
        grid-column: 2 / 4;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}

/* 카드 컴포넌트 */
.card {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: var(--box-shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    background-color: var(--gray-50);
    font-weight: 600;
    color: var(--gray-800);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    background-color: var(--gray-50);
}

/* 페이지 헤더 */
.page-header {
    background-color: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 1.5rem 0;
    margin-bottom: 2rem;
}

.page-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    font-size: var(--font-size-base);
    color: var(--gray-600);
}

/* 알림 메시지 */
.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    border: 1px solid transparent;
    position: relative;
}

.alert-success {
    background-color: rgba(5, 150, 105, 0.95);
    border-color: var(--success-color);
    color: white;
    box-shadow: var(--box-shadow-lg);
}

.alert-warning {
    background-color: rgba(217, 119, 6, 0.95);
    border-color: var(--warning-color);
    color: white;
    box-shadow: var(--box-shadow-lg);
}

.alert-danger {
    background-color: rgba(220, 38, 38, 0.95);
    border-color: var(--danger-color);
    color: white;
    box-shadow: var(--box-shadow-lg);
}

.alert-info {
    background-color: rgba(8, 145, 178, 0.95);
    border-color: var(--info-color);
    color: white;
    box-shadow: var(--box-shadow-lg);
}

/* 알림 컨테이너 */
.alert-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

/* 알림 닫기 버튼 */
.alert-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    color: inherit;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.alert-close:hover {
    opacity: 1;
}

/* 테이블 */
.table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

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

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

/* 배지 */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    font-size: var(--font-size-xs);
    font-weight: 500;
    border-radius: 9999px;
}

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

.badge-success {
    background-color: #3a5f8f;
    color: white;
}

.badge-warning {
    background-color: #d4b800;
    color: white;
}

.badge-danger {
    background-color: #6f4a8f;
    color: white;
}

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

/* 유틸리티 클래스 */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.text-primary {
    color: var(--bs-primary);
}

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

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

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

.text-muted {
    color: var(--gray-500);
}

.bg-primary {
    background-color: var(--bs-primary) !important;
}

.bg-light {
    background-color: var(--gray-100);
}

.bg-white {
    background-color: white;
}

.border {
    border: 1px solid var(--gray-200);
}

.border-0 {
    border: none;
}

.rounded {
    border-radius: var(--border-radius);
}

.shadow {
    box-shadow: var(--box-shadow);
}

.shadow-lg {
    box-shadow: var(--box-shadow-lg);
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mb-5 {
    margin-bottom: 3rem;
}

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mt-5 {
    margin-top: 3rem;
}

.p-0 {
    padding: 0;
}

.p-1 {
    padding: 0.25rem;
}

.p-2 {
    padding: 0.5rem;
}

.p-3 {
    padding: 1rem;
}

.p-4 {
    padding: 1.5rem;
}

.p-5 {
    padding: 3rem;
}

.d-none {
    display: none;
}

.d-block {
    display: block;
}

.d-flex {
    display: flex;
}

.d-inline-flex {
    display: inline-flex;
}

.justify-content-center {
    justify-content: center;
}

.justify-content-between {
    justify-content: space-between;
}

.align-items-center {
    align-items: center;
}

.w-100 {
    width: 100%;
}

.h-100 {
    height: 100%;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .btn {
        padding: 0.75rem 1rem;
        font-size: var(--font-size-base);
    }

    .card-body {
        padding: 1rem;
    }

    .page-header {
        padding: 1rem 0;
    }

    .page-title {
        font-size: var(--font-size-xl);
    }

    /* 모바일 알림 대응 */
    .alert {
        font-size: var(--font-size-sm);
        padding: 0.875rem 2rem 0.875rem 0.875rem;
    }

    .alert-close {
        font-size: 1.25rem;
    }
}

/* 로딩 스피너 */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-top: 2px solid var(--bs-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* 스크롤바 스타일링 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}