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

:root {
    --primary-color: #FFD700;
    --success-color: #10B981;
    --success-light: rgba(16, 185, 129, 0.1);
    --error-color: #EF4444;
    --error-light: rgba(239, 68, 68, 0.1);
}

/* ==================== CSS VARIABLES ==================== */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(20, 20, 32, 0.8);
    --bg-card-hover: rgba(30, 30, 48, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-input: rgba(255, 255, 255, 0.05);

    --gold-primary: #FFD700;
    --gold-light: #FFE55C;
    --gold-dark: #D4A017;
    --gold-gradient: linear-gradient(135deg, #FFD700, #F59E0B, #D97706);
    --gold-gradient-text: linear-gradient(135deg, #FFE55C, #FFD700, #F59E0B);
    --gold-glow: 0 0 20px rgba(255, 215, 0, 0.3), 0 0 40px rgba(255, 215, 0, 0.1);

    --text-primary: #f0f0f5;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --success: #10B981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --error: #EF4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    --warning: #F59E0B;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --info: #3B82F6;
    --info-bg: rgba(59, 130, 246, 0.1);

    --border-color: rgba(255, 255, 255, 0.06);
    --border-gold: rgba(255, 215, 0, 0.2);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-gold: 0 4px 20px rgba(255, 215, 0, 0.15);

    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* Background animated gradient */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse 600px 600px at 20% 10%, rgba(255, 215, 0, 0.04) 0%, transparent 70%),
        radial-gradient(ellipse 500px 500px at 80% 80%, rgba(245, 158, 11, 0.03) 0%, transparent 70%),
        radial-gradient(ellipse 400px 400px at 50% 50%, rgba(217, 119, 6, 0.02) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    animation: bgShift 20s ease-in-out infinite alternate;
}

@keyframes bgShift {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

/* ==================== LAYOUT ==================== */
.app-container {
    position: relative;
    z-index: 1;
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

/* ==================== HEADER ==================== */
.header {
    text-align: center;
    padding: 40px 0 32px;
}

.header-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background: var(--gold-gradient);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    box-shadow: var(--gold-glow);
    animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% { transform: scale(1); box-shadow: var(--gold-glow); }
    50% { transform: scale(1.05); box-shadow: 0 0 30px rgba(255, 215, 0, 0.4), 0 0 60px rgba(255, 215, 0, 0.15); }
}

.header-logo svg {
    width: 36px;
    height: 36px;
    fill: var(--bg-primary);
}

.header h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: var(--gold-gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.header p {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 400;
}

/* ==================== STEP INDICATOR ==================== */
.steps-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 32px;
    padding: 0 20px;
}

.step-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
    transition: all var(--transition-base);
    position: relative;
    flex-shrink: 0;
}

.step-dot.active {
    border-color: var(--gold-primary);
    background: var(--gold-gradient);
    color: var(--bg-primary);
    box-shadow: var(--shadow-gold);
}

.step-dot.completed {
    border-color: var(--success);
    background: var(--success);
    color: white;
}

.step-line {
    width: 60px;
    height: 2px;
    background: var(--border-color);
    transition: background var(--transition-base);
    flex-shrink: 0;
}

.step-line.active {
    background: var(--gold-gradient);
}

.step-line.completed {
    background: var(--success);
}

/* ==================== CARDS ==================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 28px;
    margin-bottom: 20px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: all var(--transition-base);
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.08);
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title .icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    flex-shrink: 0;
}

.card-title .icon.gold {
    background: rgba(255, 215, 0, 0.12);
}

.card-title .icon.blue {
    background: rgba(59, 130, 246, 0.12);
}

.card-title .icon.green {
    background: rgba(16, 185, 129, 0.12);
}

.card-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 20px;
    padding-left: 42px;
}

/* ==================== FORMS ==================== */
.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 0;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

.input-prefix {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    pointer-events: none;
}

input[type="text"] {
    width: 100%;
    padding: 14px 16px 14px 32px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    outline: none;
    transition: all var(--transition-fast);
}

input[type="text"]::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

input[type="text"]:focus {
    border-color: var(--gold-primary);
    background: rgba(255, 215, 0, 0.03);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.08);
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    flex-shrink: 0;
}

.btn:active {
    transform: scale(0.97);
}

.btn-gold {
    background: var(--gold-gradient);
    color: var(--bg-primary);
    box-shadow: var(--shadow-gold);
}

.btn-gold:hover {
    box-shadow: 0 6px 28px rgba(255, 215, 0, 0.25);
    transform: translateY(-1px);
}

.btn-gold:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-success:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

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

.btn-outline:hover {
    border-color: var(--gold-primary);
    color: var(--gold-primary);
    background: rgba(255, 215, 0, 0.05);
}

.btn-full {
    width: 100%;
    padding: 16px 24px;
    font-size: 15px;
}

/* ==================== STATUS PANELS ==================== */
.status-panel {
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-top: 16px;
    animation: slideIn 0.3s ease;
}

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

.status-panel.success {
    background: var(--success-bg);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-panel.error {
    background: var(--error-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.status-panel.warning {
    background: var(--warning-bg);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-panel.info {
    background: var(--info-bg);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.status-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 14px;
}

.status-header.success { color: var(--success); }
.status-header.error { color: var(--error); }
.status-header.warning { color: var(--warning); }
.status-header.info { color: var(--info); }

.status-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.status-detail:last-child {
    border-bottom: none;
}

.status-detail .label {
    color: var(--text-secondary);
}

.status-detail .value {
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
}

.status-detail .value.gold {
    color: var(--gold-primary);
}

.status-detail .value.success {
    color: var(--success);
}

.status-detail .value.error {
    color: var(--error);
}

/* ==================== BADGE ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-gold {
    background: rgba(255, 215, 0, 0.12);
    color: var(--gold-primary);
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-error {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ==================== LOADING ==================== */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 215, 0, 0.2);
    border-top-color: var(--gold-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-dark {
    border-color: rgba(0, 0, 0, 0.15);
    border-top-color: var(--bg-primary);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 20px;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner-lg {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 215, 0, 0.15);
    border-top-color: var(--gold-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ==================== SECTION TRANSITIONS ==================== */
.section {
    transition: all var(--transition-base);
}

.section.hidden {
    display: none;
}

.hidden {
    display: none !important;
}

.section.fade-in {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== RESULT CARD ==================== */
.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-xl);
    padding: 32px;
    text-align: center;
    margin-top: 20px;
    animation: scaleIn 0.4s ease;
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.result-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 16px;
}

.result-icon.success {
    background: var(--success-bg);
    border: 2px solid rgba(16, 185, 129, 0.3);
}

.result-icon.error {
    background: var(--error-bg);
    border: 2px solid rgba(239, 68, 68, 0.3);
}

.result-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.result-title.success { color: var(--success); }
.result-title.error { color: var(--error); }

.result-message {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

/* ==================== FOOTER ==================== */
.footer {
    text-align: center;
    padding: 24px 0;
    color: var(--text-muted);
    font-size: 12px;
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 640px) {
    .app-container {
        padding: 16px 16px 40px;
    }

    .header {
        padding: 24px 0 20px;
    }

    .header h1 {
        font-size: 22px;
    }

    .card {
        padding: 20px;
    }

    .input-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .step-line {
        width: 40px;
    }
}

/* ==================== CONFETTI ==================== */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 8px;
    height: 8px;
    top: -10px;
    animation: confettiFall 3s ease-in forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg) scale(0.3);
        opacity: 0;
    }
}

/* ==================== LOG PANEL ==================== */
.log-panel {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 16px;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    line-height: 1.8;
}

.log-panel::-webkit-scrollbar {
    width: 4px;
}

.log-panel::-webkit-scrollbar-track {
    background: transparent;
}

.log-panel::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.log-entry {
    color: var(--text-secondary);
}

.log-entry.success {
    color: var(--success);
}

.log-entry.error {
    color: var(--error);
}

.log-entry.warning {
    color: var(--warning);
}

.log-entry .timestamp {
    color: var(--text-muted);
    margin-right: 8px;
}

/* ==================== NEW ELEMENTS ==================== */

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    gap: 8px;
    margin: 20px 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    flex-wrap: wrap;
}

.nav-tab {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
}

.nav-tab:hover {
    color: var(--text-primary);
}

.nav-tab.active {
    color: var(--gold-primary);
    border-bottom-color: var(--gold-primary);
}

/* Mode Containers */
.mode-container {
    display: block;
    opacity: 1;
    transition: opacity var(--transition-base);
}

.mode-container.hidden {
    display: none;
    opacity: 0;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.select-input,
.textarea-input {
    width: 100%;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    transition: all var(--transition-base);
}

.select-input:hover,
.textarea-input:hover {
    border-color: var(--gold-primary);
}

.select-input:focus,
.textarea-input:focus {
    outline: none;
    border-color: var(--gold-primary);
    background: rgba(255, 215, 0, 0.05);
}

.textarea-input {
    resize: vertical;
    font-family: 'Monaco', 'Courier New', monospace;
    min-height: 200px;
}

/* Button Sizes */
.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* Saved Masters Container */
.saved-masters {
    margin-bottom: 12px;
}

/* Info Box */
.info-box {
    padding: 16px;
    background: var(--info-bg);
    border-left: 3px solid var(--info);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
}

/* Button Variants */
.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error-color);
    border: 1px solid var(--error-color);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

/* Progress Bar */
.progress-bar {
    background: var(--bg-secondary);
    border-radius: 4px;
    height: 20px;
    overflow: hidden;
}

/* Language switcher */
.lang-btn {
    padding: 5px 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: all var(--transition-base);
}
.lang-btn:hover { color: var(--text-primary); border-color: var(--gold-primary); }
.lang-btn.active {
    background: var(--gold-primary);
    color: #1a1a1a;
    border-color: var(--gold-primary);
}

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead th {
    text-align: left;
    padding: 10px 12px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: var(--bg-secondary);
}

.data-table .btn-small {
    padding: 4px 8px;
    font-size: 11px;
}
