/* ==========================================================================
   ResultBlaze 🔥 — Main Stylesheet
   Dark Gaming Theme (Fire & Gold accents)
   ========================================================================== */

:root {
    --bg-dark: #0b0c10;
    --bg-card: #1f2833;
    --bg-card-header: #141c24;
    --bg-input: #11161d;
    --border-color: #2c3540;
    --border-highlight: #ff6b35;
    
    --text-main: #edf5e1;
    --text-muted: #8892b0;
    --text-dark: #1f2833;

    --primary-orange: #ff6b35;
    --primary-orange-hover: #e55a28;
    --accent-gold: #ffd700;
    --accent-gold-hover: #e6c200;
    
    --status-success: #28a745;
    --status-warning: #ffc107;
    --status-danger: #dc3545;

    --font-heading: 'Rajdhani', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 15px rgba(255, 107, 53, 0.3);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ───────────────────────────────────────────────────────────── */
.site-header {
    background: #12141d;
    border-bottom: 2px solid var(--primary-orange);
    padding: 14px 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.header-inner {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-size: 26px;
    letter-spacing: 1px;
}

.logo-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 8px rgba(255, 107, 53, 0.8));
}

.logo-text {
    color: #ffffff;
}

.logo-text strong {
    color: var(--primary-orange);
}

.tagline {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

/* ── Page Wrapper ─────────────────────────────────────────────────────── */
.page-wrapper {
    max-width: 1300px;
    margin: 0 auto;
    padding: 24px 16px;
    flex: 1;
    width: 100%;
}

.hero-section {
    text-align: center;
    margin-bottom: 28px;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: 38px;
    font-weight: 700;
    letter-spacing: 1px;
}

.text-fire {
    color: var(--primary-orange);
    text-shadow: 0 0 10px rgba(255, 107, 53, 0.4);
}

.hero-sub {
    color: var(--text-muted);
    font-size: 16px;
    margin-top: 4px;
}

/* ── Cards & UI Controls ──────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-card);
}

.upload-card {
    max-width: 800px;
    margin: 0 auto 32px auto;
}

.section-label {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-gold);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

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

/* Match Type Cards */
.match-type-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.match-type-card input[type="radio"] {
    display: none;
}

.match-card-inner {
    background: var(--bg-card-header);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.match-type-card input:checked + .match-card-inner {
    border-color: var(--primary-orange);
    background: rgba(255, 107, 53, 0.1);
    box-shadow: var(--shadow-glow);
}

.match-icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.match-name {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
}

.match-hint {
    font-size: 11px;
    color: var(--text-muted);
}

/* Form Controls */
.form-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 14px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 14px;
    outline: none;
    transition: border 0.2s;
}

.form-input:focus {
    border-color: var(--primary-orange);
}

/* Drop Zone */
.upload-area {
    background: var(--bg-card-header);
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    padding: 32px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.upload-area:hover, .upload-area.drag-over {
    border-color: var(--primary-orange);
    background: rgba(255, 107, 53, 0.05);
}

.upload-icon {
    font-size: 42px;
    margin-bottom: 8px;
}

.upload-title {
    font-weight: 600;
    font-size: 16px;
    color: #ffffff;
}

.upload-browse {
    color: var(--primary-orange);
    text-decoration: underline;
    font-weight: 600;
}

.upload-limits {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.upload-tip {
    font-size: 12px;
    color: var(--accent-gold);
    margin-top: 10px;
    background: rgba(255, 215, 0, 0.08);
    padding: 6px 12px;
    border-radius: 4px;
    display: inline-block;
}

/* Image Preview Grid */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.preview-thumb {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    aspect-ratio: 16/9;
}

.preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-thumb .remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--status-danger);
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-weight: bold;
    line-height: 18px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-orange);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-orange-hover);
}

.btn-success {
    background: var(--status-success);
    color: #ffffff;
}

.btn-success:hover { background: #218838; }

.btn-warning {
    background: var(--accent-gold);
    color: var(--text-dark);
}

.btn-warning:hover { background: var(--accent-gold-hover); }

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

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

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
    border-radius: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.w-full { width: 100%; }

.btn-extract:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Progress Overlay */
.progress-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(11, 12, 16, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-box {
    background: var(--bg-card);
    border: 1px solid var(--border-highlight);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 0 30px rgba(255, 107, 53, 0.3);
}

.progress-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 107, 53, 0.2);
    border-top-color: var(--primary-orange);
    border-radius: 50%;
    animation: spin 1s infinite linear;
    margin: 0 auto 16px auto;
}

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

.progress-title {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
}

.progress-sub {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
}

.progress-bar-wrapper {
    background: var(--bg-input);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    margin: 16px 0 8px 0;
}

.progress-bar {
    height: 100%;
    background: var(--primary-orange);
    transition: width 0.3s ease;
}

.progress-pct {
    font-weight: 700;
    color: var(--accent-gold);
}

/* ── Review Page Layout ───────────────────────────────────────────────── */
.review-page {
    padding-top: 16px;
}

.summary-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 20px;
    margin-bottom: 20px;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-label {
    color: var(--text-muted);
    font-size: 12px;
}

.summary-value {
    font-weight: 700;
    color: #ffffff;
}

.review-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
}

@media (max-width: 992px) {
    .review-layout {
        grid-template-columns: 1fr;
    }
}

/* Prize Calculator Panel */
.prize-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    height: fit-content;
}

.prize-panel-header {
    background: var(--bg-card-header);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-gold);
    display: flex;
    align-items: center;
    gap: 8px;
}

.prize-panel-body {
    padding: 16px;
}

.prize-field {
    margin-bottom: 14px;
}

.prize-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.prize-input-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.prize-input-row input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 6px 10px;
    color: #fff;
}

.prize-unit {
    color: var(--text-muted);
    font-size: 12px;
}

.prize-divider {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary-orange);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 14px 0 8px 0;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 4px;
}

.position-prizes-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 260px;
    overflow-y: auto;
    padding-right: 4px;
}

.pos-prize-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.pos-label {
    font-size: 12px;
    color: var(--text-main);
    width: 80px;
}

.pos-prize-input {
    width: 90px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px;
    color: #fff;
    font-size: 12px;
    text-align: right;
}

.prize-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.prize-total-val {
    color: var(--accent-gold);
    font-size: 16px;
    font-family: var(--font-heading);
}

/* Result Table Section */
.result-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
}

.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.table-search {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 10px 8px 32px;
    color: #fff;
    outline: none;
}

.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.result-table th {
    background: var(--bg-card-header);
    color: var(--text-muted);
    font-weight: 600;
    text-align: left;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    user-select: none;
}

.result-table th.sortable {
    cursor: pointer;
}

.result-table th.sortable:hover {
    color: var(--primary-orange);
}

.result-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
}

.result-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.row-warning {
    background: rgba(255, 193, 7, 0.08) !important;
}

.editable {
    cursor: pointer;
}

.editable:hover {
    background: rgba(255, 107, 53, 0.15);
    outline: 1px dashed var(--primary-orange);
}

.editable:focus {
    background: var(--bg-input);
    outline: 2px solid var(--primary-orange);
    color: #fff;
}

.cell-total {
    font-weight: 700;
    color: var(--accent-gold);
}

.table-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    font-size: 12px;
}

/* Alerts & Toasts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-error {
    background: rgba(220, 53, 69, 0.15);
    border: 1px solid var(--status-danger);
    color: #ff858d;
}

.alert-warning {
    background: rgba(255, 193, 7, 0.15);
    border: 1px solid var(--status-warning);
    color: #ffe082;
}

.alert-sm {
    padding: 8px 12px;
    font-size: 12px;
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border-left: 4px solid var(--primary-orange);
    color: #fff;
    padding: 12px 16px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    font-size: 13px;
    animation: slideIn 0.3s ease;
}

.toast-success { border-left-color: var(--status-success); }
.toast-error { border-left-color: var(--status-danger); }
.toast-warning { border-left-color: var(--status-warning); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Footer */
.site-footer {
    background: #08090c;
    border-top: 1px solid var(--border-color);
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 32px;
}

.footer-sep { margin: 0 6px; }
.site-footer a { color: var(--primary-orange); text-decoration: none; }
