/* 대한크리에이터양성협회 - 커스텀 스타일 */

/* 폰트 설정 */
* {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* 접근성을 위한 스크린 리더 전용 텍스트 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sr-only.focus\:not-sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: 0.5rem;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* 스무스 스크롤 */
html {
    scroll-behavior: smooth;
}

/* 커스텀 색상 변수 */
:root {
    --primary-blue: #1e40af;
    --primary-green: #047857;
    --accent-yellow: #fbbf24;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-light: #f9fafb;
}

/* 헤더 스타일 개선 */
header {
    transition: all 0.3s ease;
}

/* 페이지 로딩 시 깜빡임 방지 */
#header-placeholder:empty {
    min-height: 200px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 페이지 초기 로드 시 레이아웃 안정성 */
body {
    min-height: 100vh;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* 헤더 로드 전 레이아웃 예약 */
#header-placeholder {
    min-height: 120px;
}

header.scrolled {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

/* 네비게이션 드롭다운 효과 */
.nav-dropdown {
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.group:hover .nav-dropdown {
    transform: translateY(0);
}

/* 드롭다운 메뉴 스타일 개선 */
nav .group > div {
    z-index: 50;
    transform-origin: top;
    transform: scaleY(0);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

nav .group:hover > div {
    transform: scaleY(1);
}

/* 드롭다운 항목 호버 효과 */
nav .group div a {
    transition: all 0.2s ease;
}

nav .group div a:hover {
    padding-left: 2rem;
}

/* 메뉴 구분선 스타일 */
nav .group div .border-b {
    border-color: #e5e7eb;
}

nav .group div .border-t {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}

/* 히어로 섹션 배경 그라데이션 */
.hero-gradient {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 25%, #065f46 50%, #047857 100%);
}

/* 카드 스타일 */
.service-card {
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: #e5e7eb;
}

/* 버튼 효과 */
.btn-primary {
    background: linear-gradient(45deg, var(--primary-blue), var(--primary-green));
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(30, 64, 175, 0.3);
}

.btn-secondary {
    border: 2px solid white;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-secondary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: white;
    transition: left 0.3s ease;
    z-index: -1;
}

.btn-secondary:hover::before {
    left: 0;
}

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

/* 애니메이션 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.8s ease-out;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.pulse-slow {
    animation: pulse 3s ease-in-out infinite;
}

/* 통계 카운터 애니메이션 */
.counter {
    font-variant-numeric: tabular-nums;
}

/* 스크롤 인디케이터 */
.scroll-indicator {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* 로딩 상태 */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* 상담 예약 모달 커스텀 스타일 */
.consultation-type .radio-indicator {
    transition: all 0.2s ease;
}

.consultation-type .radio-indicator::after {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: white;
    margin: auto;
    margin-top: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* 예약 모달 애니메이션 */
#reservation-modal {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#reservation-modal.hidden {
    opacity: 0;
    visibility: hidden;
}

#reservation-modal .modal-content {
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

#reservation-modal:not(.hidden) .modal-content {
    transform: scale(1);
}

/* 상담 유형 라디오 버튼 커스터마이징 */
.consultation-type input[type="radio"]:checked + .radio-indicator {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
}

.consultation-type input[type="radio"]:checked + .radio-indicator::after {
    opacity: 1;
}

/* 관심 분야 체크박스 스타일링 */
.topic-checkbox {
    position: relative;
    cursor: pointer;
}

.topic-checkbox input[type="checkbox"] {
    opacity: 0;
    position: absolute;
}

.topic-checkbox .checkbox-indicator {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    margin-right: 8px;
    transition: all 0.2s ease;
    position: relative;
}

.topic-checkbox input[type="checkbox"]:checked + .checkbox-indicator {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
}

.topic-checkbox .checkbox-indicator::after {
    content: '✓';
    position: absolute;
    top: -2px;
    left: 3px;
    color: white;
    font-size: 14px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.topic-checkbox input[type="checkbox"]:checked + .checkbox-indicator::after {
    opacity: 1;
}

/* 시간대 선택 버튼 스타일링 */
.time-slots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.time-slot-btn {
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-size: 14px;
}

.time-slot-btn:hover {
    border-color: var(--primary-blue);
    background-color: #f0f9ff;
}

.time-slot-btn.selected {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
    color: white;
}

.time-slot-btn:disabled {
    background-color: #f3f4f6;
    border-color: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

/* 폼 필드 포커스 스타일 개선 */
#reservation-modal input:focus,
#reservation-modal select:focus,
#reservation-modal textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 필수 입력 필드 표시 */
.required-field::after {
    content: ' *';
    color: #dc2626;
    font-weight: bold;
}

/* 유효성 검사 오류 스타일 */
.field-error {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1) !important;
}

.error-message {
    color: #dc2626;
    font-size: 14px;
    margin-top: 4px;
    display: none;
}

.field-error + .error-message {
    display: block;
}

/* 성공 메시지 스타일 */
.success-message {
    background-color: #10b981;
    color: white;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    margin-top: 16px;
}

/* 로딩 스피너 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* 문의하기 모달 커스텀 스타일 */
#contact-modal {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#contact-modal.hidden {
    opacity: 0;
    visibility: hidden;
}

#contact-modal .modal-content {
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

#contact-modal:not(.hidden) .modal-content {
    transform: scale(1);
}

/* 문의 유형 라디오 버튼 커스터마이징 */
.contact-type input[type="radio"]:checked + .radio-indicator {
    background-color: rgba(59, 130, 246, 0.1);
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.contact-type .radio-indicator {
    transition: all 0.2s ease;
}

.contact-type .radio-indicator:hover {
    border-color: #93c5fd;
}

/* 첨부파일 드롭존 스타일 */
.contact-file-dropzone {
    transition: all 0.2s ease;
}

.contact-file-dropzone.dragover {
    border-color: var(--primary-blue) !important;
    background-color: rgba(59, 130, 246, 0.05) !important;
}

/* 파일 목록 아이템 스타일 */
#file-list .file-item {
    animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 문의 폼 필드 포커스 스타일 */
#contact-modal input:focus,
#contact-modal select:focus,
#contact-modal textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

/* 응답형 개선 - 문의 모달 */
@media (max-width: 768px) {
    #contact-modal .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }
    
    .contact-type .grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .contact-type .radio-indicator {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .contact-type .radio-indicator i {
        font-size: 1rem;
    }
}

/* 사용자 메뉴 스타일 */
.user-menu {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid #e5e7eb;
}

.user-menu a:hover {
    background-color: #f8fafc;
}

.user-menu .border-t a:hover {
    background-color: #fef2f2;
}

/* 로그인 버튼 상태 */
.login-btn {
    transition: all 0.2s ease;
}

.login-btn:hover {
    transform: translateY(-1px);
}

/* 모바일 사용자 섹션 */
#mobile-user-section {
    animation: slideInUp 0.3s ease-out;
}

#mobile-user-section button {
    transition: all 0.2s ease;
}

#mobile-user-section button:hover {
    transform: translateY(-1px);
}

/* 스크롤 애니메이션 최적화 */
.animate-in {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.service-card:not(.animate-in) {
    opacity: 0;
    transform: translateY(30px);
}

.fade-in-up:not(.animate-in) {
    opacity: 0;
    transform: translateY(20px);
}

/* 지연 로딩 이미지 */
img.lazy {
    opacity: 0;
    transition: opacity 0.3s;
}

img:not(.lazy) {
    opacity: 1;
}

/* GPU 가속화를 위한 최적화 */
.service-card,
.nav-dropdown,
.modal-content,
.user-menu {
    will-change: transform;
}

/* 스크롤 성능 최적화 */
.hero-gradient {
    will-change: transform;
}

/* 부드러운 스크롤 최적화 */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
    
    .service-card {
        transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    }
}

/* 반응형 개선 */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
        line-height: 1.2;
    }
    
    .nav-mobile {
        display: block;
    }
    
    .nav-desktop {
        display: none;
    }
}

@media (min-width: 769px) {
    .nav-mobile {
        display: none;
    }
    
    .nav-desktop {
        display: block;
    }
}

/* 접근성 개선 */
*:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

button:focus, 
a:focus, 
input:focus, 
select:focus, 
textarea:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* 고대비 모드 지원 */
@media (prefers-contrast: high) {
    :root {
        --text-primary: #000000;
        --text-secondary: #333333;
    }
}

/* 모션 감소 모드 지원 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* 다크모드 준비 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-light: #111827;
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
    }
}

/* 프린트 스타일 */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-friendly {
        background: white !important;
        color: black !important;
    }
    
    a {
        text-decoration: underline;
    }
    
    .page-break {
        page-break-after: always;
    }
}

/* 커스텀 스크롤바 (Webkit 브라우저) */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #1e3a8a;
}

/* 선택 텍스트 스타일 */
::selection {
    background: var(--accent-yellow);
    color: var(--text-primary);
}

::-moz-selection {
    background: var(--accent-yellow);
    color: var(--text-primary);
}

/* 모바일 반응형 개선 추가 */
@media (max-width: 768px) {
    /* 모바일 텍스트 크기 최적화 */
    h1 {
        font-size: 1.875rem;
        line-height: 2.25rem;
    }
    
    h2 {
        font-size: 1.5rem;
        line-height: 2rem;
    }
    
    h3 {
        font-size: 1.25rem;
        line-height: 1.75rem;
    }
    
    /* 모바일 버튼 터치 영역 최적화 */
    button, .btn, a {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* 모바일 입력 필드 */
    input, select, textarea {
        font-size: 16px; /* iOS 줌 방지 */
    }
    
    /* 모바일 카드 간격 */
    .grid {
        gap: 1rem;
    }
    
    /* 모바일 테이블 스크롤 */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        font-size: 0.875rem;
    }
    
    /* 모바일 모달 */
    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }
    
    /* 모바일 네비게이션 */
    #mobile-menu {
        width: 100%;
        max-width: 320px;
    }
    
    /* 모바일 드롭다운 */
    .dropdown-content {
        position: fixed;
        left: 0;
        right: 0;
        width: 100%;
    }
    
    /* 모바일 푸터 */
    footer .grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    /* 모바일 플로팅 버튼 */
    #floating-nav-btn {
        bottom: 1rem;
        right: 1rem;
        width: 56px;
        height: 56px;
    }
    
    /* 모바일 이미지 최적화 */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* 모바일 패딩 조정 */
    .px-8 {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .py-12 {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    
    /* 모바일 마진 조정 */
    .mt-16 {
        margin-top: 3rem;
    }
    
    .mb-12 {
        margin-bottom: 2rem;
    }
    
    /* 모바일 그리드 반응형 */
    .md\:grid-cols-2,
    .md\:grid-cols-3,
    .md\:grid-cols-4 {
        grid-template-columns: 1fr;
    }
    
    /* 모바일 히어로 섹션 */
    .hero-section {
        padding: 3rem 1rem;
    }
    
    .hero-title {
        font-size: 2rem;
        line-height: 2.5rem;
    }
    
    /* 모바일 통계 카드 */
    .stat-card {
        padding: 1rem;
    }
    
    /* 모바일 서비스 카드 */
    .service-card {
        padding: 1.5rem;
    }
    
    /* 모바일 브레드크럼 */
    .breadcrumb {
        font-size: 0.75rem;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 모바일 페이지네이션 */
    .pagination button {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    /* 모바일 탭 */
    .tab-button {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    /* 모바일 알림 메시지 */
    .notification, .message {
        left: 1rem;
        right: 1rem;
        width: auto;
    }
}

/* 태블릿 반응형 */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 768px;
    }
    
    .md\:grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .md\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 소형 모바일 (iPhone SE 등) */
@media (max-width: 375px) {
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    button, .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}

/* 가로 모드 모바일 */
@media (max-height: 600px) and (orientation: landscape) {
    header {
        position: relative;
    }
    
    .modal-content {
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }
}

/* 노치가 있는 기기 대응 */
@supports (padding-top: env(safe-area-inset-top)) {
    header {
        padding-top: env(safe-area-inset-top);
    }
    
    #mobile-menu {
        padding-top: env(safe-area-inset-top);
    }
    
    footer {
        padding-bottom: env(safe-area-inset-bottom);
    }
}