/**
 * Terra Hosting — Toss × Control Panel Design
 *
 * Design: 다크 도메인 헤더 + 화이트 2열 정보 카드
 * Palette: #0F172A dark header / #191F28 text / #3182F6 accent
 * Motion: staggered fade-up on panel load
 */

:root {
    --th-text-primary:   #191F28;
    --th-text-secondary: #4E5968;
    --th-text-tertiary:  #8B95A1;
    --th-border:         #EAECF0;
    --th-blue:           #3182F6;
    --th-blue-light:     #EBF3FE;
    --th-shadow:         0 1px 3px rgba(0,0,0,0.06), 0 4px 14px rgba(0,0,0,0.05);
}

/* ===========================================
   래퍼
   =========================================== */

.terra-hosting-wrapper {
    max-width: 720px;
    font-weight: 400;
}

/* ===========================================
   사이트 선택 드롭다운
   =========================================== */

.terra-hosting-wrapper .hosting-site-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 11px 16px;
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--th-shadow);
}

.terra-hosting-wrapper .hosting-site-picker svg {
    color: var(--th-text-tertiary);
    flex-shrink: 0;
    display: block !important;
    width: 15px !important;
    height: 15px !important;
    min-width: 15px !important;
    max-width: 15px !important;
}

.terra-hosting-wrapper .hosting-site-select {
    flex: 1;
    border: 1px solid var(--th-border);
    border-radius: 8px;
    background: #F8F9FA;
    padding: 7px 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--th-text-primary);
    cursor: pointer;
    outline: none;
    font-family: inherit;
    letter-spacing: -0.01em;
}

.terra-hosting-wrapper .hosting-site-select:focus {
    border-color: var(--th-blue);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(49,130,246,0.10);
}

/* ===========================================
   패널 전환 — !important 필수 (WC 테마 방어)
   =========================================== */

.terra-hosting-wrapper .hosting-panel { display: none !important; }
.terra-hosting-wrapper .hosting-panel.active { display: block !important; }

/* ===========================================
   도메인 헤더 — 다크 카드
   =========================================== */

.terra-hosting-wrapper .hosting-domain-header {
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
    border-radius: 18px;
    padding: 24px 28px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
    animation: terra-fadeUp 0.32s ease both;
}

/* 도트 그리드 텍스처 */
.terra-hosting-wrapper .hosting-domain-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 22px 22px;
    pointer-events: none;
}

.terra-hosting-wrapper .domain-header-left { position: relative; }

.terra-hosting-wrapper .domain-name {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 20px;
    font-weight: 500;
    color: #fff;
    font-family: 'SF Mono', 'Fira Code', Monaco, monospace;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.terra-hosting-wrapper .domain-name svg {
    color: rgba(255,255,255,0.4) !important;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    max-width: 18px !important;
    flex-shrink: 0;
}

.terra-hosting-wrapper .domain-type {
    display: block;
    font-size: 11px;
    color: rgba(255,255,255,0.3);
    margin-top: 7px;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.terra-hosting-wrapper .domain-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    position: relative;
}

.terra-hosting-wrapper .domain-created {
    font-size: 11px;
    color: rgba(255,255,255,0.25);
    letter-spacing: 0.01em;
}

/* 다크 헤더 안 상태 배지 */
.terra-hosting-wrapper .hosting-domain-header .status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.terra-hosting-wrapper .hosting-domain-header .status-badge::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.terra-hosting-wrapper .hosting-domain-header .status-badge.status-completed {
    background: rgba(16,185,129,0.15);
    color: #34D399;
    border: 1px solid rgba(16,185,129,0.25);
}

.terra-hosting-wrapper .hosting-domain-header .status-badge.status-completed::before {
    background: #34D399;
    animation: terra-host-pulse 2s ease-in-out infinite;
}

.terra-hosting-wrapper .hosting-domain-header .status-badge.status-in_progress {
    background: rgba(251,191,36,0.15);
    color: #FCD34D;
    border: 1px solid rgba(251,191,36,0.25);
}

.terra-hosting-wrapper .hosting-domain-header .status-badge.status-in_progress::before {
    background: #FCD34D;
}

.terra-hosting-wrapper .hosting-domain-header .status-badge.status-failed {
    background: rgba(239,68,68,0.15);
    color: #FCA5A5;
    border: 1px solid rgba(239,68,68,0.25);
}

.terra-hosting-wrapper .hosting-domain-header .status-badge.status-failed::before {
    background: #FCA5A5;
}

@keyframes terra-host-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0.5); }
    50%       { box-shadow: 0 0 0 5px rgba(52,211,153,0); }
}

/* ===========================================
   정보 그리드 — 2열
   =========================================== */

.terra-hosting-wrapper .hosting-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
    animation: terra-fadeUp 0.32s 0.08s ease both;
}

/* ===========================================
   섹션 카드
   =========================================== */

.terra-hosting-wrapper .hosting-section {
    background: #fff;
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: var(--th-shadow);
}

.terra-hosting-wrapper .hosting-section h2 {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 600;
    color: var(--th-text-tertiary);
    margin: 0 0 13px;
    padding: 0 0 11px;
    border-bottom: 1px solid #F3F4F6;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

/* SVG 아이콘 크기 강제 (WC svg 리셋 방어) */
.terra-hosting-wrapper .hosting-section h2 svg {
    display: inline-block !important;
    width: 14px !important;
    height: 14px !important;
    min-width: 14px !important;
    max-width: 14px !important;
    flex-shrink: 0;
    color: var(--th-text-tertiary);
}

/* ===========================================
   자격증명 행
   =========================================== */

.terra-hosting-wrapper .credentials-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.terra-hosting-wrapper .credential-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 0;
    border-bottom: 1px solid #F3F4F6;
    background: transparent;
    border-radius: 0;
}

.terra-hosting-wrapper .credential-item:first-child { padding-top: 0; }
.terra-hosting-wrapper .credential-item:last-child  { border-bottom: none; padding-bottom: 0; }

.terra-hosting-wrapper .credential-label {
    min-width: 52px;
    font-size: 12px;
    color: var(--th-text-tertiary);
    font-weight: 400;
    flex-shrink: 0;
    letter-spacing: -0.01em;
}

.terra-hosting-wrapper .credential-value-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.terra-hosting-wrapper .credential-value {
    flex: 1;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    font-size: 13px;
    font-weight: 400;
    color: var(--th-text-primary);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: none !important;
    height: auto !important;
    outline: none;
    cursor: default;
}

/* ===========================================
   액션 버튼
   =========================================== */

.terra-hosting-wrapper .toggle-password-btn,
.terra-hosting-wrapper .copy-btn,
.terra-hosting-wrapper .open-link-btn {
    padding: 4px 6px !important;
    border: 1px solid var(--th-border) !important;
    border-radius: 6px !important;
    background: #F8F9FA !important;
    cursor: pointer;
    transition: background 0.13s ease, border-color 0.13s ease !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    box-shadow: none !important;
    line-height: 1 !important;
    height: auto !important;
    width: auto !important;
    flex-shrink: 0;
}

.terra-hosting-wrapper .toggle-password-btn:hover,
.terra-hosting-wrapper .copy-btn:hover,
.terra-hosting-wrapper .open-link-btn:hover {
    background: var(--th-blue-light) !important;
    border-color: var(--th-blue) !important;
}

.woocommerce-account .terra-hosting-wrapper .toggle-password-btn .dashicons,
.woocommerce-account .terra-hosting-wrapper .copy-btn .dashicons,
.woocommerce-account .terra-hosting-wrapper .open-link-btn .dashicons {
    font-size: 13px !important;
    width: 13px !important;
    height: 13px !important;
    color: var(--th-text-tertiary) !important;
    transition: color 0.13s ease;
}

.woocommerce-account .terra-hosting-wrapper .toggle-password-btn:hover .dashicons,
.woocommerce-account .terra-hosting-wrapper .copy-btn:hover .dashicons,
.woocommerce-account .terra-hosting-wrapper .open-link-btn:hover .dashicons {
    color: var(--th-blue) !important;
}

/* ===========================================
   캐시 관리 — 가로 행
   =========================================== */

.terra-hosting-wrapper .hosting-cache-row {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px !important;
    animation: terra-fadeUp 0.32s 0.14s ease both;
}

.terra-hosting-wrapper .cache-row-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.terra-hosting-wrapper .cache-row-content > svg {
    color: var(--th-text-tertiary);
    flex-shrink: 0;
    display: block !important;
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    max-width: 16px !important;
}

.terra-hosting-wrapper .cache-row-title {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--th-text-primary);
    letter-spacing: -0.01em;
}

.terra-hosting-wrapper .cache-row-desc {
    display: block;
    font-size: 12px;
    color: var(--th-text-tertiary);
    margin-top: 2px;
}

.woocommerce-account .terra-hosting-wrapper #terra-clear-cache-btn {
    background: #F2F4F6 !important;
    color: var(--th-text-secondary) !important;
    border: none !important;
    border-radius: 9px !important;
    padding: 8px 16px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    cursor: pointer;
    transition: background 0.13s ease !important;
    box-shadow: none !important;
    text-shadow: none !important;
    height: auto !important;
    line-height: 1.5 !important;
    white-space: nowrap;
    flex-shrink: 0;
}

.woocommerce-account .terra-hosting-wrapper #terra-clear-cache-btn:hover {
    background: #E5E8EB !important;
    color: var(--th-text-primary) !important;
}

/* ===========================================
   빈 상태
   =========================================== */

.terra-hosting-wrapper .empty-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--th-text-tertiary);
    font-size: 14px;
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--th-shadow);
}

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

@keyframes terra-fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===========================================
   숏코드 스타일 (terra_hosting_info)
   =========================================== */

.terra-shortcode-wrap {
    display: flex;
    justify-content: center;
    padding: 16px 0;
}

.terra-sc-card {
    background: #fff;
    border-radius: 16px;
    padding: 24px 28px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--th-shadow);
}

.terra-sc-item { margin-bottom: 14px; }

.terra-sc-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: var(--th-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 4px;
}

.terra-sc-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--th-text-primary);
    text-decoration: none;
    word-break: break-all;
    font-family: 'SF Mono', Monaco, monospace;
}

.terra-sc-link:hover { color: var(--th-blue); }

.terra-sc-buttons { display: flex; gap: 8px; margin-top: 20px; }

.terra-sc-btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 10px;
    text-decoration: none;
    text-align: center;
    transition: background 0.13s ease;
    background: #F2F4F6;
    color: var(--th-text-secondary);
    border: none;
    cursor: pointer;
    display: block;
    letter-spacing: -0.01em;
}

.terra-sc-btn:hover { background: #E5E8EB; color: var(--th-text-primary); }

.terra-sc-btn-primary { background: var(--th-blue); color: #fff; }
.terra-sc-btn-primary:hover { background: #1B64DA; color: #fff; }

.terra-sc-divider { height: 1px; background: #F3F4F6; margin: 18px 0; }

.terra-sc-section-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--th-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 10px;
}

.terra-sc-credentials { display: flex; flex-direction: column; gap: 4px; }

.terra-sc-cred-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 13px;
    background: #F8F9FA;
    border-radius: 9px;
}

.terra-sc-cred-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--th-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 48px;
}

.terra-sc-cred-value {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--th-text-primary);
    font-family: 'SF Mono', Monaco, monospace;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.terra-sc-cred-value.terra-sc-pw-hidden { color: #D1D5DB; letter-spacing: 2px; }

.terra-sc-toggle,
.terra-sc-copy {
    padding: 4px 10px !important;
    font-size: 11px !important;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.13s ease;
    border: 1px solid var(--th-border);
    background: #fff;
    color: var(--th-text-secondary);
    white-space: nowrap;
}

.terra-sc-toggle:hover,
.terra-sc-copy:hover {
    background: var(--th-blue-light);
    border-color: var(--th-blue);
    color: var(--th-blue);
}

.terra-sc-copy.copied { background: var(--th-blue-light); border-color: var(--th-blue); color: var(--th-blue); }

.terra-sc-empty { text-align: center; padding: 40px 24px; }
.terra-sc-empty p { font-size: 14px; color: var(--th-text-tertiary); margin: 0 0 20px; }

/* ===========================================
   반응형
   =========================================== */

@media (max-width: 640px) {
    .terra-hosting-wrapper .hosting-info-grid {
        grid-template-columns: 1fr;
    }

    .terra-hosting-wrapper .hosting-domain-header {
        flex-direction: column;
        gap: 16px;
        padding: 20px 22px;
    }

    .terra-hosting-wrapper .domain-header-right {
        align-items: flex-start;
    }

    .terra-hosting-wrapper .domain-name {
        font-size: 17px;
    }

    .terra-hosting-wrapper .hosting-cache-row {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 14px;
    }

    .terra-hosting-wrapper .hosting-section {
        padding: 16px;
    }
}
