/* CSS Reset & Variable */
:root {
    --bg-dark: #0f1411;
    --panel-bg: rgba(20, 28, 24, 0.65);
    --panel-border: rgba(255, 255, 255, 0.07);
    --primary: #00e676; /* 네온 그린 */
    --primary-glow: rgba(0, 230, 118, 0.3);
    --text-main: #f5f6f5;
    --text-muted: #8fa095;
    --yellow: #ffd600;
    --blue: #00e5ff;
    --accent: #2e7d32;
    --font-outfit: 'Outfit', 'Noto Sans KR', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-outfit);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* 배경 데코레이션 */
.glass-bg-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    overflow: hidden;
    pointer-events: none;
}

.blur-sphere {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.2;
}

.sphere-green {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    right: -100px;
}

.sphere-blue {
    width: 500px;
    height: 500px;
    background: var(--blue);
    bottom: -150px;
    left: -150px;
}

/* 레이아웃 컨테이너 */
.app-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 헤더 */
.app-header {
    text-align: center;
    margin-bottom: 40px;
}

.logo-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-area h1 {
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.logo-area h1 span {
    color: var(--primary);
    text-shadow: 0 0 15px var(--primary-glow);
}

.icon-logo {
    width: 38px;
    height: 38px;
    color: var(--primary);
    filter: drop-shadow(0 0 8px var(--primary));
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 300;
}

/* 글래스 패널 */
.glass-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* 업로드 영역 */
.upload-container {
    max-width: 680px;
    margin: 0 auto;
    text-align: center;
}

.drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 50px 30px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
    transition: all 0.3s ease;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(0, 230, 118, 0.03);
    box-shadow: inset 0 0 20px rgba(0, 230, 118, 0.05);
}

.icon-upload {
    width: 64px;
    height: 64px;
    color: var(--text-muted);
    margin-bottom: 20px;
    transition: color 0.3s ease;
}

.drop-zone:hover .icon-upload {
    color: var(--primary);
}

.drop-zone h3 {
    font-size: 1.4rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.upload-tip {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 25px;
    line-height: 1.5;
}

/* 버튼 공통 */
.btn {
    font-family: var(--font-outfit);
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.btn-primary {
    background: linear-gradient(135deg, #00e676, #00b0ff);
    color: #0b110e;
    box-shadow: 0 4px 15px rgba(0, 230, 118, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 230, 118, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--panel-border);
}

.btn-outline:hover {
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 25px 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.divider:not(:empty)::before {
    margin-right: .55em;
}

.divider:not(:empty)::after {
    margin-left: .55em;
}

.test-alternative p {
    color: var(--text-muted);
    margin-bottom: 15px;
    font-size: 0.95rem;
}

/* 로딩 스피너 애니메이션 */
.loader-container {
    text-align: center;
    padding: 40px 10px;
}

.loader-container h2 {
    font-size: 1.6rem;
    margin-bottom: 10px;
}

.loader-container p {
    color: var(--text-muted);
    margin-bottom: 30px;
}

.golf-ball-loader {
    width: 80px;
    height: 80px;
    position: relative;
    margin: 0 auto 30px;
}

.golf-ball-loader .ball {
    width: 40px;
    height: 40px;
    background: #ffffff;
    border-radius: 50%;
    position: absolute;
    top: 0;
    left: 20px;
    box-shadow: inset -4px -4px 10px rgba(0, 0, 0, 0.15), 0 0 10px rgba(255, 255, 255, 0.4);
    animation: bounce 1s infinite alternate cubic-bezier(0.45, 0.05, 0.55, 0.95);
}

.golf-ball-loader .shadow {
    width: 30px;
    height: 6px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    position: absolute;
    bottom: 5px;
    left: 25px;
    filter: blur(1px);
    animation: shadowScale 1s infinite alternate cubic-bezier(0.45, 0.05, 0.55, 0.95);
}

@keyframes bounce {
    0% { transform: translateY(0); }
    100% { transform: translateY(35px); }
}

@keyframes shadowScale {
    0% { transform: scale(0.3); opacity: 0.3; }
    100% { transform: scale(1.1); opacity: 0.8; }
}

.progress-bar-container {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    margin: 0 auto 15px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.status-text {
    font-size: 0.9rem;
    color: var(--primary);
}

/* 결과 대시보드 그리드 */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 30px;
}

.grid-col {
    min-width: 0; /* flex/grid 내에서 텍스트 잘림 현상 방지 */
}

#chart-card {
    grid-column: 1 / 2;
}

#feedback-card {
    grid-column: 2 / 3;
}

@media (max-width: 992px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    #chart-card, #feedback-card {
        grid-column: auto;
    }
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 15px;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title i {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

/* 비디오 플레이어 */
.video-wrapper {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    position: relative;
}

.video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.tab-buttons {
    display: flex;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 3px;
}

.tab-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: var(--primary);
    color: #0b110e;
}

.video-info-overlay {
    margin-top: 15px;
    background: rgba(0, 0, 0, 0.2);
    padding: 12px;
    border-radius: 10px;
}

.timeline-markers {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.marker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.marker-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.marker-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.color-addr { background-color: #ffffff; box-shadow: 0 0 6px #ffffff; }
.color-top { background-color: var(--yellow); box-shadow: 0 0 6px var(--yellow); }
.color-impact { background-color: var(--primary); box-shadow: 0 0 6px var(--primary); }
.color-finish { background-color: var(--blue); box-shadow: 0 0 6px var(--blue); }

/* 종합 스코어 섹션 */
.score-overview {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 30px;
}

.radial-score-container {
    position: relative;
    width: 120px;
    height: 120px;
}

.radial-progress {
    width: 120px;
    height: 120px;
    position: relative;
}

.radial-progress svg {
    transform: rotate(-90deg);
}

.radial-progress circle {
    fill: transparent;
    stroke-width: 8;
}

.radial-progress circle.bg {
    stroke: rgba(255, 255, 255, 0.06);
}

.radial-progress circle.bar {
    stroke: var(--primary);
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease-out;
}

.score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

#score-number {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-main);
    display: block;
    line-height: 1;
}

.score-total {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.score-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.grade-badge {
    background: linear-gradient(135deg, #1b5e20, #00e676);
    color: #f5f6f5;
    padding: 6px 14px;
    border-radius: 30px;
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    display: inline-block;
    width: fit-content;
    box-shadow: 0 4px 10px rgba(0, 230, 118, 0.2);
}

.report-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* 핵심 스코어 목록 */
.metric-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.metric-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.metric-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    font-weight: 500;
}

.metric-title {
    display: flex;
    align-items: center;
    gap: 6px;
}

.metric-title i {
    width: 18px;
    height: 18px;
}

.metric-val {
    font-weight: 600;
}

.text-yellow { color: var(--yellow); }
.text-green { color: var(--primary); }
.text-blue { color: var(--blue); }

.bg-yellow { background-color: var(--yellow); }
.bg-green { background-color: var(--primary); }
.bg-blue { background-color: var(--blue); }

.progress-bar-container.sm {
    height: 5px;
}

/* 차트 섹션 */
.chart-toggles {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 2px;
}

.chart-toggle-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 5px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
}

.chart-toggle-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.chart-wrapper {
    width: 100%;
    height: 250px;
    position: relative;
}

/* 피드백 영역 */
.feedback-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.feedback-block {
    background: rgba(255, 255, 255, 0.02);
    border-left: 3px solid rgba(255, 255, 255, 0.15);
    padding: 12px 15px;
    border-radius: 0 10px 10px 0;
}

.feedback-block:nth-child(1) { border-left-color: var(--yellow); }
.feedback-block:nth-child(2) { border-left-color: var(--primary); }
.feedback-block:nth-child(3) { border-left-color: var(--blue); }

.feedback-block h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.feedback-block h3 .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.feedback-block p {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* 푸터 */
.app-footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* 유틸리티 */
.d-none {
    display: none !important;
}

/* 재생 속도 컨트롤러 스타일 */
.playback-speed-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.playback-speed-control .control-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.playback-speed-control .control-label i {
    width: 15px;
    height: 15px;
    color: var(--primary);
}

.speed-chips {
    display: flex;
    gap: 6px;
}

.speed-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--panel-border);
    color: var(--text-muted);
    padding: 4px 10px;
    font-size: 0.78rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-outfit);
    transition: all 0.2s ease;
}

.speed-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.speed-btn.active {
    background: var(--primary);
    color: #0b110e;
    border-color: var(--primary);
    font-weight: 600;
}

/* 분석 이력 섹션 스타일 */
#history-section {
    margin-top: 40px;
}

.history-count {
    font-size: 0.85rem;
    color: var(--primary);
    background: rgba(0, 230, 118, 0.08);
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 10px;
}

.history-card {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 6px 20px var(--primary-glow);
    background: rgba(0, 230, 118, 0.02);
}

.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-card-header .date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.history-card-header .mini-badge {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
}

.badge-a { background: #1b5e20; color: #fff; }
.badge-b { background: #e65100; color: #fff; }
.badge-c { background: #b71c1c; color: #fff; }
.badge-d { background: #37474f; color: #fff; }

.history-card-body {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.history-card-body .score {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-main);
}

.history-card-body .score-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.history-card-footer {
    font-size: 0.8rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 10px;
    color: var(--text-muted);
    font-size: 0.95rem;
    border: 1px dashed rgba(255, 255, 255, 0.08);
    border-radius: 12px;
}
