/**
 * 택배어디(WhereParcel) - 최적화된 스타일시트
 * 통합 배송조회 서비스 UI 스타일
 * 반응형 디자인 지원 (모바일 우선)
 */

/* ==========================================================================
   기본 설정 및 리셋
   ========================================================================== */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==========================================================================
   헤더 섹션
   ========================================================================== */

.header {
    background: white;
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

/* 로고 스타일 */
.logo {
    display: flex;
    align-items: center;
    color: #000;
}

.logo-text {
    color: #666;
    font-size: 16px;
    font-weight: normal;
    transition: color 0.3s ease;
}

.logo:hover .logo-text {
    color: #00d4aa;
}

.logo-icon {
    margin-right: 8px;
    width: 28px;
    height: 28px;
    object-fit: contain;
}

/* 네비게이션 메뉴 */
.nav {
    display: flex;
    gap: 30px;
}

.nav-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #666;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
    gap: 8px;
}

.nav-link:hover {
    background: #f5f5f5;
    color: #00d4aa;
}

.laptop-icon {
    font-size: 20px;
}

/* ==========================================================================
   메인 콘텐츠
   ========================================================================== */

.main {
    flex: 1;
}

/* ==========================================================================
   히어로 섹션 (메인 검색 영역)
   ========================================================================== */

.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 60px 0 80px;
    text-align: center;
    color: white;
}

.hero-subtitle {
    font-size: 18px;
    font-weight: 300;
    margin-bottom: 15px;
    opacity: 0.9;
}

.hero-title {
    font-size: 48px;
    font-weight: 300;
    margin-bottom: 50px;
    line-height: 1.2;
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 8px;
}

.title-question {
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    animation: fadeInLeft 0.8s ease-out;
}

.title-emphasis {
    font-weight: 800;
    font-size: 1.2em;
    color: #fff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    animation: bounceIn 1s ease-out 0.3s both;
    position: relative;
}

.title-emphasis::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #00d4aa, transparent);
    animation: underlineGlow 2s ease-in-out infinite;
}

.title-mark {
    font-weight: 300;
    font-size: 1.1em;
    color: #00d4aa;
    animation: bounceIn 1.2s ease-out 0.6s both;
}

/* 검색 컨테이너 */
.search-container {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.search-input {
    flex: 1;
    border: none;
    padding: 20px 30px;
    font-size: 16px;
    outline: none;
    background: transparent;
    color: #333;
}

.search-input::placeholder {
    color: #999;
}

.search-btn {
    background: #00d4aa;
    color: white;
    border: none;
    padding: 20px 40px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-btn:hover {
    background: #00c199;
    transform: translateY(-1px);
}

/* 쿠팡 파트너스 안내 */
.coupang-notice {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    margin: 0;
    padding: 10px 0 0 0;
}

.hero-description {
    font-size: 18px;
    opacity: 0.9;
    margin-top: 40px;
    transition: margin-top 0.3s ease;
}

.hero-description.with-hint {
    margin-top: 45px;
}

.description-line {
    margin-bottom: 5px;
}

/* 택배사 힌트 스타일 */
#carrierHint {
    animation: fadeIn 0.3s ease-in-out;
    margin-top: 5px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
    color: white;
    display: none;
    opacity: 0.9;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* ==========================================================================
   애니메이션
   ========================================================================== */

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(50px);
    }
    50% {
        opacity: 1;
        transform: scale(1.1) translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes underlineGlow {
    0%, 100% {
        opacity: 0.5;
        transform: scaleX(0.8);
    }
    50% {
        opacity: 1;
        transform: scaleX(1.1);
    }
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(-10px); 
    }
    to { 
        opacity: 0.9; 
        transform: translateY(0); 
    }
}

@keyframes pulse {
    0% { 
        box-shadow: 0 0 0 0 rgba(0, 212, 170, 0.4); 
    }
    70% { 
        box-shadow: 0 0 0 10px rgba(0, 212, 170, 0); 
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(0, 212, 170, 0); 
    }
}

@keyframes pulseRed {
    0% { 
        box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7); 
    }
    70% { 
        box-shadow: 0 0 0 20px rgba(255, 71, 87, 0); 
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(255, 71, 87, 0); 
    }
}

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

/* ==========================================================================
   결과 섹션
   ========================================================================== */

.result-section {
    padding: 40px 0;
    background: #f8f9fa;
}

.result-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    margin-bottom: 40px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
}

.result-header h2 {
    color: #333;
    font-size: 24px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #f0f0f0;
    color: #666;
}

/* ==========================================================================
   배송 추적 진행 상황 (5단계)
   ========================================================================== */

.delivery-progress {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px 20px 70px;
    margin-bottom: 30px;
    overflow: hidden;
}

.progress-title {
    color: #333;
    font-size: 20px;
    margin-bottom: 25px;
    text-align: center;
    font-weight: 600;
}

.tracking-steps-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    overflow: hidden;
    padding: 20px 0 60px;
}

.tracking-step-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    position: relative;
}

.tracking-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 15px;
    min-width: 120px;
    transition: all 0.3s ease;
    position: relative;
}

.step-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    border: 3px solid #e9ecef;
}

.tracking-step.active .step-icon {
    background: #74a9ff;
    border-color: #74a9ff;
    color: white;
    transform: scale(1.1);
}

.tracking-step.current .step-icon {
    background: #74a9ff;
    border-color: #ff4757;
    border-width: 3px;
    color: white;
    animation: pulseRed 1.2s infinite;
}

.step-number {
    font-size: 10px;
    color: #666;
    margin-bottom: 5px;
    font-weight: 500;
}

.tracking-step.active .step-number,
.tracking-step.current .step-number {
    color: #74a9ff;
    font-weight: 600;
}

.tracking-step.current .step-number {
    color: #ff4757;
}

.step-name {
    font-size: 14px;
    font-weight: 600;
    color: #666;
    margin-bottom: 3px;
}

.tracking-step.active .step-name,
.tracking-step.current .step-name {
    color: #74a9ff;
}

.tracking-step.current .step-name {
    color: #ff4757;
}

.step-connector {
    width: calc(100% - 60px);
    height: 4px;
    background: #e9ecef;
    position: absolute;
    top: 45px;
    left: 135px;
    transition: all 0.3s ease;
    z-index: 1;
    border-radius: 2px;
}

.step-connector.active {
    background: #74a9ff;
}

.step-update-time {
    font-size: 11px;
    color: #333;
    font-weight: 500;
    padding: 3px 8px;
    background: transparent;
    border-radius: 4px;
    border: 1px solid #333;
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    z-index: 2;
}

/* ==========================================================================
   상세 정보 섹션
   ========================================================================== */

.delivery-details {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.details-title {
    color: #333;
    font-size: 18px;
    margin-bottom: 20px;
    font-weight: 600;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}

.detail-card {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.detail-card:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.detail-icon {
    font-size: 24px;
    margin-right: 15px;
    width: 40px;
    text-align: center;
}

.detail-content {
    flex: 1;
}

.detail-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 3px;
    font-weight: 500;
}

.detail-value {
    font-size: 14px;
    color: #333;
    font-weight: 600;
}

/* ==========================================================================
   택배사 섹션
   ========================================================================== */

.carriers-section {
    padding: 60px 0;
    background: white;
}

.carriers-title {
    text-align: center;
    font-size: 28px;
    color: #333;
    margin-bottom: 40px;
    position: relative;
}

.carriers-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: #00d4aa;
}

.carriers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.carrier-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    border-radius: 10px;
    transition: all 0.3s ease;
    min-height: 130px;
}

.carrier-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.carrier-item img {
    width: 140px;
    height: 90px;
    object-fit: contain;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: block;
    margin: auto;
}

/* ==========================================================================
   푸터
   ========================================================================== */

.footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 25px 0;
    margin-top: auto;
}

.footer p {
    font-size: 14px;
    opacity: 0.8;
}

/* ==========================================================================
   로딩 모달
   ========================================================================== */

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

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #00d4aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

/* ==========================================================================
   에러 메시지
   ========================================================================== */

.error-message {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    text-align: center;
    color: #2d3748;
}

.error-message.not-found {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
}

.error-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.error-message h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #2d3748;
}

.error-description {
    font-size: 16px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.error-suggestions {
    text-align: left;
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.error-suggestions h4 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 16px;
}

.error-suggestions ul {
    list-style: none;
    padding: 0;
}

.error-suggestions li {
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    color: #4a5568;
}

.error-suggestions li:last-child {
    border-bottom: none;
}

.supported-carriers {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-top: 20px;
    text-align: left;
}

.supported-carriers h4 {
    color: #2d3748;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
}

.carrier-list {
    display: grid;
    gap: 12px;
    margin-bottom: 25px;
}

.supported-carriers .carrier-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    min-height: auto;
}

.carrier-name {
    font-weight: 600;
    color: #2d3748;
}

.carrier-format {
    font-size: 14px;
    color: #64748b;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.tips-section {
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.tip {
    margin: 10px 0;
    padding: 12px 16px;
    background: #f0f9ff;
    border-left: 4px solid #0ea5e9;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.6;
    color: #0c4a6e;
}

/* ==========================================================================
   반응형 디자인 (모바일)
   ========================================================================== */

@media (max-width: 768px) {
    /* 헤더 모바일 대응 */
    .header .container {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    /* 히어로 섹션 모바일 대응 */
    .hero-title {
        font-size: 28px;
        flex-direction: row;
        gap: 4px;
        justify-content: center;
        align-items: center;
        text-align: center;
    }
    
    .title-emphasis {
        font-size: 1.2em;
    }
    
    .search-container {
        flex-direction: column;
        border-radius: 15px;
    }
    
    .search-input {
        border-radius: 15px 15px 0 0;
    }
    
    .search-btn {
        border-radius: 0 0 15px 15px;
    }
    
    /* 네비게이션 모바일 대응 */
    .nav {
        display: flex;
        flex-direction: row;
        gap: 5px;
        margin-top: 10px;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .nav-link {
        font-size: 11px;
        padding: 4px 8px;
        white-space: nowrap;
    }
    
    /* 결과 섹션 모바일 대응 */
    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .close-btn {
        align-self: flex-end;
    }
    
    /* 배송 추적 모바일 대응 - 세로 배열 */
    .tracking-steps-container {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .tracking-step-container {
        width: 100%;
        justify-content: center;
    }
    
    .step-connector {
        display: none;
    }
    
    .step-update-time {
        position: static;
        transform: none;
        margin-top: 8px;
        bottom: auto;
        left: auto;
    }
    
    .delivery-progress {
        padding-bottom: 30px;
    }
    
    /* 상세 정보 모바일 대응 - 1열 */
    .details-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .detail-card {
        padding: 12px;
    }
    
    /* 모바일에서 배송상태 아이콘 크기 증가 */
    .detail-icon {
        font-size: 32px;
        margin-right: 20px;
        width: 50px;
        text-align: center;
    }
    
    /* 택배사 그리드 모바일 대응 */
    .carriers-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 20px;
    }
    
    .carrier-item img {
        width: 130px;
        height: 85px;
        object-fit: contain;
        display: block;
        margin: auto;
    }
    
    .carrier-item {
        padding: 15px;
        min-height: 120px;
        justify-content: center;
    }
    
    /* 일반 섹션 모바일 대응 */
    .delivery-progress,
    .delivery-details {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .error-message {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .error-icon {
        font-size: 36px;
    }
    
    .error-message h3 {
        font-size: 18px;
    }
    
    .supported-carriers .carrier-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .carrier-format {
        font-size: 12px;
    }
}

/* 태블릿 대응 */
@media (min-width: 769px) and (max-width: 1024px) {
    .details-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 매우 작은 모바일 (480px 이하) */
@media (max-width: 480px) {
    .carriers-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .carrier-item img {
        width: 90px;
        height: 60px;
    }
    
    /* 매우 작은 화면에서도 배송상태 아이콘 크게 */
    .detail-icon {
        font-size: 36px;
        margin-right: 15px;
        width: 55px;
    }
    
    .carrier-item {
        padding: 10px;
    }
    
    .carriers-title {
        font-size: 20px;
        margin-bottom: 30px;
    }
}