/* ================================================================
   CC-GEN v2.0 — Main Stylesheet
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-ui);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ─── Header ─── */
.app-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

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

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    color: #fff;
}

.header-title {
    font-size: 20px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-version {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    padding: 2px 8px;
    background: var(--bg-glass);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── Icon Buttons ─── */
.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-glass);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 16px;
}

.icon-btn:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    border-color: var(--border-active);
}

/* ─── Disclaimer Banner ─── */
.disclaimer-banner {
    background: rgba(245, 158, 11, 0.08);
    border-bottom: 1px solid rgba(245, 158, 11, 0.2);
    padding: 8px 16px;
    text-align: center;
    font-size: 12px;
    color: var(--accent-warning);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1.5;
}

.disclaimer-banner strong {
    font-weight: 700;
}

/* ─── Main Grid ─── */
.main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 16px;
}

/* ─── Glass Panel ─── */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.panel-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-title-icon {
    font-size: 14px;
}

.panel-body {
    padding: 20px;
}

/* ─── 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 {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 14px;
    transition: all var(--transition-fast);
    outline: none;
}

.form-input:focus {
    background: var(--bg-input-focus);
    border-color: var(--border-active);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

.form-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 13px;
    transition: all var(--transition-fast);
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-select:focus {
    border-color: var(--border-active);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ─── Quick Presets ─── */
.quick-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.preset-btn {
    padding: 6px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    background: var(--bg-glass);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.preset-btn:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    border-color: var(--border-active);
}

.preset-btn.active {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
}

/* ─── Inline Form Row ─── */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

/* ─── Range Slider ─── */
.range-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.range-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    outline: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--gradient-primary);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
    transition: transform var(--transition-fast);
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.range-value {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    min-width: 48px;
    text-align: center;
    color: var(--accent-primary);
    background: var(--bg-input);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

/* ─── Generate Button ─── */
.btn-generate {
    width: 100%;
    padding: 14px 24px;
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-ui);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.btn-generate:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow), var(--shadow-lg);
}

.btn-generate:active {
    transform: translateY(0) scale(0.98);
}

.btn-generate .btn-icon {
    font-size: 18px;
}

/* ─── Output Area ─── */
.output-textarea {
    width: 100%;
    min-height: 200px;
    max-height: 400px;
    padding: 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.7;
    resize: vertical;
    outline: none;
    overflow-y: auto;
}

.output-textarea:focus {
    border-color: var(--border-active);
}

.output-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.btn-action {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-glass);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-action:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    border-color: var(--border-active);
}

.btn-action.btn-copy.copied {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--accent-success);
    color: var(--accent-success);
}

/* ─── Statistics ─── */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
}

.stat-card {
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.stat-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-value.success {
    color: var(--accent-success);
}

/* ─── Bottom Panels (Tabs) ─── */
.bottom-panels {
    padding: 0 16px 16px;
}

.tab-bar {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    margin-bottom: 16px;
    overflow-x: auto;
}

.tab-btn {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    justify-content: center;
}

.tab-btn:hover {
    color: var(--text-secondary);
    background: var(--bg-glass);
}

.tab-btn.active {
    color: var(--text-primary);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

.tab-panel-inner {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
}

/* ─── History Panel ─── */
.history-list {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
    gap: 12px;
}

.history-item:hover {
    background: var(--bg-glass-hover);
}

.history-number {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-primary);
}

.history-brand {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--bg-input);
}

.history-empty {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ─── BIN Lookup Panel ─── */
.lookup-result {
    margin-top: 16px;
}

.lookup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.lookup-item {
    padding: 10px 14px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}

.lookup-item-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.lookup-item-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ─── Validator Panel ─── */
.validation-results {
    margin-top: 16px;
}

.validation-check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.validation-check:last-child {
    border-bottom: none;
}

.check-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.check-icon.pass {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
}

.check-icon.fail {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-danger);
}

.check-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.confidence-bar {
    margin-top: 16px;
    padding: 14px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}

.confidence-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.confidence-track {
    height: 8px;
    background: var(--bg-glass);
    border-radius: 4px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--gradient-primary);
    transition: width 0.4s ease;
}

/* ─── Toast Notifications ─── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
    backdrop-filter: blur(12px);
}

.toast-success {
    border-color: rgba(16, 185, 129, 0.3);
}

.toast-error {
    border-color: rgba(239, 68, 68, 0.3);
}

/* ─── Footer ─── */
.app-footer {
    text-align: center;
    padding: 24px 16px;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 12px;
}

.app-footer a {
    color: var(--accent-primary);
    text-decoration: none;
}

.app-footer a:hover {
    text-decoration: underline;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ─── Selection ─── */
::selection {
    background: rgba(99, 102, 241, 0.3);
    color: var(--text-primary);
}

/* ─── Focus visible ─── */
:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}
