/* ===== CSS Variables ===== */
:root {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-card: #f8f9fa;
    --bg-input: #ffffff;
    --border-color: #e0e3e8;
    --border-hover: #c0c4cc;
    --text-primary: #1a1a2e;
    --text-secondary: #555770;
    --text-muted: #888a9a;
    --accent-1: #6c5ce7;
    --accent-2: #00b4d8;
    --accent-3: #e94560;
    --accent-4: #f59e0b;
    --gradient-1: linear-gradient(135deg, #6c5ce7, #a29bfe);
    --gradient-2: linear-gradient(135deg, #00b4d8, #48cae4);
    --gradient-3: linear-gradient(135deg, #e94560, #ff6b6b);
    --gradient-hero: linear-gradient(135deg, #6c5ce7 0%, #00b4d8 50%, #e94560 100%);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
    --shadow-glow: 0 0 30px rgba(108,92,231,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== Header ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    height: 70px;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
}

.logo-icon {
    color: var(--accent-1);
    display: flex;
}

.logo-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 18px;
}

.logo-dot {
    color: var(--accent-2);
}

.nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(108, 92, 231, 0.1);
}

/* ===== Hero ===== */
.hero {
    padding: 80px 0 10px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(108,92,231,0.06) 0%, transparent 50%);
    animation: heroGlow 8s ease-in-out infinite alternate;
}

@keyframes heroGlow {
    0% { transform: translate(-20%, -20%); }
    100% { transform: translate(20%, 20%); }
}

.hero-badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(108, 92, 231, 0.15);
    border: 1px solid rgba(108, 92, 231, 0.3);
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-1);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.hero-title {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(24px, 3vw, 36px);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.gradient-text {
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.4;
}

/* ===== Tool Section ===== */
.tool-section {
    padding: 10px 10px 10px;
}

.tool-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    min-height: calc(100vh - 100px);
}

/* ===== Controls Panel ===== */
.controls-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    position: sticky;
    top: 70px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    align-self: start;
}

.controls-panel::-webkit-scrollbar {
    display: none;
}
.controls-panel {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.panel-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    flex-shrink: 0;
}

.panel-tab {
    flex: 1;
    min-width: 0;
    padding: 14px 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    position: relative;
}

.panel-tab:hover {
    color: var(--text-secondary);
}

.panel-tab.active {
    color: var(--accent-1);
}

.panel-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-1);
}

.tab-content {
    display: none;
    padding: 24px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.tab-content::-webkit-scrollbar {
    display: none;
}
.tab-content::-webkit-scrollbar-track {
    background: transparent;
}
.tab-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

/* ===== Form Elements ===== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input, .form-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-row:has(.form-input:nth-child(3)) {
    grid-template-columns: 1fr 1fr 1fr;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%239090a8' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ===== File Upload ===== */
.file-upload {
    position: relative;
}

.file-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-label {
    display: block;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.file-label:hover {
    border-color: var(--accent-1);
    color: var(--accent-1);
}

.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }

/* ===== Color Picker ===== */
.color-picker-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.color-picker {
    width: 44px;
    height: 44px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: none;
    padding: 2px;
    box-shadow: var(--shadow-sm);
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-text {
    flex: 1;
    font-family: 'Space Grotesk', monospace;
    font-size: 13px;
}

/* ===== Range Slider ===== */
.form-range {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-input);
    border-radius: 3px;
    outline: none;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-1);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.4);
}

.range-value {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 8px;
}

/* ===== Section Header ===== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.section-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: #0096c7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-add {
    padding: 6px 12px;
    background: rgba(0, 180, 216, 0.1);
    border: 1px solid rgba(0, 180, 216, 0.3);
    border-radius: var(--radius-sm);
    color: #0096c7;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-add:hover {
    background: rgba(0, 180, 216, 0.2);
}

/* ===== Player Cards ===== */
.player-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 8px;
    position: relative;
}

.player-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.player-number {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-1);
    background: rgba(108, 92, 231, 0.1);
    padding: 2px 8px;
    border-radius: 20px;
}

.btn-remove {
    width: 24px;
    height: 24px;
    background: rgba(253, 121, 168, 0.1);
    border: none;
    border-radius: 50%;
    color: var(--accent-3);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-remove:hover {
    background: rgba(253, 121, 168, 0.2);
}

.player-fields {
    display: grid;
    gap: 6px;
}

.player-fields .form-input {
    padding: 8px 10px;
    font-size: 12px;
}

.player-fields-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 6px;
}

/* ===== Export Section ===== */
.export-section {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.btn-export {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 16px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-export-image {
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.btn-export-image:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108, 92, 231, 0.4);
}

.btn-export-pdf {
    background: var(--gradient-3);
    color: white;
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.3);
}

.btn-export-pdf:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(233, 69, 96, 0.4);
}

/* ===== Preview Panel ===== */
.preview-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    position: sticky;
    top: 70px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    align-self: start;
}

.preview-panel::-webkit-scrollbar {
    display: none;
}
.preview-panel {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    flex-shrink: 0;
}

.preview-header h2 {
    font-size: 16px;
    font-weight: 700;
}

.preview-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-preview-action {
    padding: 6px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-preview-action:hover {
    border-color: var(--accent-1);
    color: var(--accent-1);
}

.preview-container {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: repeating-conic-gradient(#e8eaed 0% 25%, #f0f1f4 0% 50%) 50% / 20px 20px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.preview-container::-webkit-scrollbar {
    display: none;
}

.scorecard-wrapper {
    transform-origin: top center;
    transition: transform 0.3s ease;
    width: 100%;
    max-width: 800px;
}

.scorecard-wrapper .sc-card {
    overflow: visible;
}

/* ===== Template Info ===== */
.template-info {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.template-thumb {
    aspect-ratio: 16/10;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 6px;
    font-size: 5px;
}

.template-thumb:hover {
    border-color: var(--accent-1);
    transform: scale(1.05);
}

.template-thumb.active {
    border-color: var(--accent-2);
    box-shadow: 0 0 15px rgba(0, 206, 201, 0.3);
}

.template-thumb-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.8);
    color: white;
    font-size: 8px;
    font-weight: 600;
    padding: 3px 5px;
    text-align: center;
}

/* ===== Features Section ===== */
.features-section {
    padding: 80px 0;
    background: var(--bg-secondary);
}

.section-title {
    text-align: center;
    font-family: 'Outfit', sans-serif;
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 800;
    margin-bottom: 50px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.feature-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    transition: var(--transition);
}

.feature-card:hover {
    border-color: var(--accent-1);
    transform: translateY(-5px);
    box-shadow: var(--shadow-glow);
}

.feature-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(108, 92, 231, 0.1);
    border-radius: var(--radius-md);
    color: #6c5ce7;
}

.feature-card h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

/* ===== How It Works ===== */
.how-section {
    padding: 80px 0;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.step-card {
    text-align: center;
    padding: 32px 20px;
}

.step-number {
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-1);
    border-radius: 50%;
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 800;
    color: white;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.step-card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
}

.step-card p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===== Footer ===== */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 60px 0 30px;
}

.footer-inner {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 12px;
    max-width: 300px;
}

.footer-links h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.footer-links a {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    padding: 4px 0;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--accent-1);
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
    .tool-layout {
        grid-template-columns: 1fr;
    }
    
    .controls-panel, .preview-panel {
        position: static;
        max-height: none;
    }
    
    .preview-container {
        max-height: 600px;
    }
}

@media (max-width: 768px) {
    .nav { display: none; }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .steps-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-inner {
        grid-template-columns: 1fr;
    }
    
    .templates-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-row:has(.form-input:nth-child(3)) {
        grid-template-columns: 1fr;
    }
    
    .export-section {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .templates-grid {
        grid-template-columns: 1fr;
    }
    
    .steps-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Print Styles ===== */
@media print {
    .header, .controls-panel, .features-section, .how-section, .footer, .preview-header {
        display: none !important;
    }
    
    .tool-layout {
        grid-template-columns: 1fr;
    }
    
    .preview-panel {
        border: none;
    }
}