/* ============================================================
   NovaCert — Premium Dark Theme
   Certificate Generator UI
   ============================================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
    /* Colors */
    --bg-primary: #08080c;
    --bg-secondary: #0f0f16;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    --bg-input: rgba(255, 255, 255, 0.05);

    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(196, 30, 58, 0.3);

    --text-primary: #f0f0f5;
    --text-secondary: rgba(240, 240, 245, 0.6);
    --text-tertiary: rgba(240, 240, 245, 0.35);

    --accent-red: #C41E3A;
    --accent-red-light: #e8354f;
    --accent-red-glow: rgba(196, 30, 58, 0.15);
    --accent-gold: #D4A843;
    --accent-gold-light: #e8c060;
    --accent-gold-glow: rgba(212, 168, 67, 0.12);

    --success: #22c55e;
    --success-glow: rgba(34, 197, 94, 0.15);
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow-red: 0 0 40px rgba(196, 30, 58, 0.15);
    --shadow-glow-gold: 0 0 40px rgba(212, 168, 67, 0.1);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Layout */
    --max-width: 860px;
    --header-height: 64px;
}

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

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

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

/* ---------- Ambient Background ---------- */
.ambient-glow {
    position: fixed;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 600px;
    background: radial-gradient(ellipse, rgba(196, 30, 58, 0.06) 0%, rgba(212, 168, 67, 0.03) 40%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ---------- Language Selection Screen ---------- */
.lang-selection-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 100px);
    padding: var(--space-xl);
    position: relative;
    z-index: 1;
}

.lang-card {
    max-width: 520px;
    width: 100%;
    text-align: center;
}

.lang-header h1 {
    margin-bottom: var(--space-sm);
    text-align: center;
}

.lang-logo {
    max-height: 38px;
    width: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto var(--space-xs);
}

.lang-novacert {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 2px;
    text-transform: uppercase;
    display: block;
}

.lang-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--space-xl);
}

.lang-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.lang-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xl) var(--space-lg);
    background: var(--bg-input);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-family);
    color: var(--text-primary);
}

.lang-option:hover {
    border-color: var(--accent-red);
    background: var(--accent-red-glow);
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow-red);
}

.lang-flag {
    font-size: 2.5rem;
    line-height: 1;
}

.lang-name {
    font-size: 1.2rem;
    font-weight: 700;
}

.lang-desc {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

/* Language Badge in Step 1 */
.selected-lang-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 6px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    margin-bottom: var(--space-md);
    font-size: 0.8rem;
}

.lang-badge-flag {
    font-size: 1rem;
}

.lang-badge-text {
    font-weight: 600;
    color: var(--text-secondary);
}

.lang-change-btn {
    background: none;
    border: none;
    color: var(--accent-red-light);
    font-family: var(--font-family);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.lang-change-btn:hover {
    background: var(--accent-red-glow);
}

/* ---------- Header ---------- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(8, 8, 12, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.logo-icon {
    display: flex;
    align-items: center;
    filter: drop-shadow(0 2px 8px rgba(196, 30, 58, 0.3));
}

.logo-img {
    height: 36px;
    width: auto;
    object-fit: contain;
}

.logo-text {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo-nova {
    color: var(--accent-red, #C41E3A);
}

.logo-cert {
    background: linear-gradient(135deg, var(--accent-red, #C41E3A), var(--text-tertiary, #888));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    font-weight: 400;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-align: center;
    margin: 0;
}

.header-left {
    flex: 0 0 auto;
}

.header-center {
    flex: 1;
    text-align: center;
}

/* ---------- Login Screen ---------- */

.login-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    background: var(--bg-primary);
}

.login-screen.hidden {
    display: none;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px 32px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    max-height: 38px;
    width: auto;
    margin-bottom: 12px;
}

.login-novacert {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.login-desc {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-field label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-field input {
    padding: 12px 14px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-fast);
}

.login-field input:focus {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px var(--accent-red-glow);
}

.login-error {
    color: var(--accent-red);
    font-size: 0.82rem;
    text-align: center;
    min-height: 1.2em;
}

.login-btn {
    width: 100%;
    padding: 12px;
    font-size: 0.95rem;
    margin-top: 4px;
}

/* Hide main app when not logged in */
body:not(.logged-in) .app-header,
body:not(.logged-in) #lang-screen,
body:not(.logged-in) #wizard-container,
body:not(.logged-in) .app-footer {
    display: none !important;
}

body.logged-in .login-screen {
    display: none !important;
}

/* ---------- Wizard Navigation ---------- */
.wizard-nav {
    max-width: var(--max-width);
    margin: var(--space-xl) auto var(--space-lg);
    padding: 0 var(--space-lg);
    position: relative;
    z-index: 1;
}

.wizard-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    cursor: default;
    position: relative;
}

.step-number {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    background: var(--bg-input);
    border: 2px solid var(--border-medium);
    color: var(--text-tertiary);
    transition: all var(--transition-base);
}

.wizard-step.active .step-number {
    background: linear-gradient(135deg, var(--accent-red), var(--accent-red-light));
    border-color: var(--accent-red);
    color: #fff;
    box-shadow: 0 0 20px rgba(196, 30, 58, 0.3);
}

.wizard-step.completed .step-number {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.wizard-step.completed .step-number::after {
    content: '✓';
    font-size: 0.9rem;
}

.wizard-step.completed .step-number span {
    display: none;
}

.step-label {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color var(--transition-base);
    white-space: nowrap;
}

.wizard-step.active .step-label {
    color: var(--text-primary);
}

.wizard-step.completed .step-label {
    color: var(--text-secondary);
}

.wizard-connector {
    width: 60px;
    height: 2px;
    background: var(--border-medium);
    margin: 0 var(--space-sm);
    margin-bottom: 20px;
    border-radius: 1px;
    overflow: hidden;
    position: relative;
}

.connector-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--success), var(--accent-gold));
    border-radius: 1px;
    transition: width var(--transition-slow);
}

.wizard-connector.filled .connector-fill {
    width: 100%;
}

/* ---------- Wizard Content ---------- */
.wizard-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-lg);
    position: relative;
    z-index: 1;
}

.step-panel {
    display: none;
    animation: fadeSlideIn 0.4s ease-out;
}

.step-panel.active {
    display: block;
}

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

/* ---------- Glass Card ---------- */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
}

.card-header {
    margin-bottom: var(--space-xl);
}

.card-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    margin-bottom: var(--space-sm);
}

.step-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.step-description strong {
    color: var(--accent-gold);
    font-weight: 600;
}

.section-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* ---------- Upload Zone ---------- */
.upload-zone {
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-lg);
    padding: var(--space-3xl) var(--space-xl);
    text-align: center;
    transition: all var(--transition-base);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.upload-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent-red-glow), var(--accent-gold-glow));
    opacity: 0;
    transition: opacity var(--transition-base);
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--accent-red);
    background: var(--bg-card-hover);
}

.upload-zone:hover::before,
.upload-zone.drag-over::before {
    opacity: 1;
}

.upload-zone.drag-over {
    transform: scale(1.01);
}

.upload-icon-wrapper {
    position: relative;
    z-index: 1;
    margin-bottom: var(--space-md);
}

.upload-icon {
    color: var(--text-tertiary);
    transition: color var(--transition-base);
}

.upload-zone:hover .upload-icon {
    color: var(--accent-red);
}

.upload-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    position: relative;
    z-index: 1;
}

.upload-subtext {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin: var(--space-sm) 0;
    position: relative;
    z-index: 1;
}

.upload-formats {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: var(--space-md);
    position: relative;
    z-index: 1;
}

.sample-download-wrapper {
    margin-top: var(--space-md);
    position: relative;
    z-index: 2;
}

.sample-download-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 6px 16px;
    background: rgba(212, 168, 67, 0.1);
    border: 1px solid rgba(212, 168, 67, 0.3);
    border-radius: var(--radius-full);
    color: var(--accent-gold-light);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.sample-download-link:hover {
    background: rgba(212, 168, 67, 0.2);
    border-color: var(--accent-gold);
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow-gold);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-red), var(--accent-red-light));
    color: #fff;
    box-shadow: 0 2px 12px rgba(196, 30, 58, 0.3);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 4px 20px rgba(196, 30, 58, 0.5);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1.5px solid var(--border-medium);
    position: relative;
    z-index: 1;
}

.btn-outline:hover {
    border-color: var(--accent-red);
    color: var(--accent-red-light);
    background: var(--accent-red-glow);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-input);
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all var(--transition-fast);
    font-family: var(--font-family);
}

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

.upload-btn {
    position: relative;
    z-index: 1;
}

/* ---------- File Info ---------- */
.file-info {
    margin-top: var(--space-lg);
}

.file-badge {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--success-glow);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: var(--radius-md);
    animation: fadeSlideIn 0.3s ease-out;
}

.file-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.file-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.file-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.file-rows {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.file-remove {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    transition: all var(--transition-fast);
}

.file-remove:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* ---------- Data Preview Table ---------- */
.data-preview {
    margin-top: var(--space-xl);
    animation: fadeSlideIn 0.4s ease-out;
}

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

.table-wrapper table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.table-wrapper th {
    background: rgba(255, 255, 255, 0.05);
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-medium);
}

.table-wrapper td {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-wrapper tr:last-child td {
    border-bottom: none;
}

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

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    background: var(--accent-red-glow);
    color: var(--accent-red-light);
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
}

/* ---------- Column Mapping ---------- */
.mapping-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.mapping-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.mapping-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-input);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    transition: border-color var(--transition-fast);
    flex-wrap: wrap;
}

.mapping-row:hover {
    border-color: var(--border-medium);
}

.mapping-row.mapped {
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.03);
}

.mapping-field {
    flex: 0 0 160px;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.mapping-field-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.mapping-field-icon.name { background: rgba(196, 30, 58, 0.15); }
.mapping-field-icon.date { background: rgba(212, 168, 67, 0.15); }
.mapping-field-icon.training { background: rgba(59, 130, 246, 0.15); }

.mapping-field-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.mapping-arrow {
    color: var(--text-tertiary);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.mapping-select {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color var(--transition-fast);
    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 1.5L6 6.5L11 1.5' stroke='%23888' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.mapping-select:focus {
    outline: none;
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px var(--accent-red-glow);
}

.mapping-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.mapping-sample {
    padding: var(--space-lg);
    background: var(--bg-input);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    font-size: 0.88rem;
    line-height: 1.8;
}

.sample-field {
    color: var(--text-secondary);
}

.sample-value {
    font-weight: 600;
    color: var(--accent-gold);
}

.sample-value.name-val {
    color: var(--accent-red-light);
}

/* ---------- Mode Selection ---------- */
.mode-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.mode-card {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-subtle);
    background: var(--bg-input);
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
}

.mode-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.mode-card:hover {
    border-color: var(--border-medium);
    background: var(--bg-card-hover);
}

.mode-card.selected {
    border-color: var(--accent-red);
    background: var(--accent-red-glow);
    box-shadow: var(--shadow-glow-red);
}

.mode-icon {
    flex-shrink: 0;
    color: var(--text-tertiary);
    transition: color var(--transition-base);
}

.mode-card.selected .mode-icon {
    color: var(--accent-red-light);
}

.mode-info h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.mode-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.mode-info p strong {
    color: var(--accent-gold);
}

.mode-check {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    color: var(--border-medium);
    transition: color var(--transition-base);
}

.mode-card.selected .mode-check {
    color: var(--accent-red);
}

/* ---------- Certificate Preview ---------- */
.cert-preview-section {
    margin-top: var(--space-lg);
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.preview-nav {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.preview-counter {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 50px;
    text-align: center;
}

.preview-frame {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #fff;
    aspect-ratio: 842 / 595;
    position: relative;
}

/* Certificate HTML Mock */
.cert-mock {
    width: 100%;
    height: 100%;
    position: relative;
    background: #fff;
    font-family: 'Montserrat', sans-serif;
    overflow: hidden;
}

.cert-mock .cert-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Certificate text overlays — blank template, aligned to KATILIM SERTİFİKASI (x=108px / 12.8%) */
.cert-mock .cert-overlay {
    position: absolute;
    color: #222;
    z-index: 2;
}

.cert-mock .cert-name {
    left: 12.8%;
    top: 44.1%;
    font-size: clamp(0.85rem, 2.6vw, 1.35rem);
    font-weight: 500;
    color: #222;
}

.cert-mock .cert-paragraph {
    left: 12.8%;
    top: 50.6%;
    font-size: clamp(0.5rem, 1.4vw, 0.76rem);
    color: #333;
    line-height: 1.4;
    max-width: 76%;
}

.cert-mock .cert-paragraph .cert-training {
    font-weight: 700;
    font-style: italic;
    color: #111;
}

/* ---------- Generate Section ---------- */
.generate-summary {
    margin-bottom: var(--space-xl);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.summary-item {
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-input);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.summary-label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-tertiary);
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.summary-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.generate-action {
    text-align: center;
    padding: var(--space-lg) 0;
}

.btn-generate {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 16px 40px;
    background: linear-gradient(135deg, var(--accent-red), #a8142e);
    color: #fff;
    border: none;
    border-radius: var(--radius-lg);
    font-family: var(--font-family);
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 4px 24px rgba(196, 30, 58, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-generate::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.btn-generate:hover::before {
    transform: translateX(100%);
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(196, 30, 58, 0.5);
}

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

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

.btn-generate-icon {
    flex-shrink: 0;
}

/* ---------- Progress ---------- */
.progress-section {
    margin-top: var(--space-xl);
    animation: fadeSlideIn 0.3s ease-out;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
}

.progress-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.progress-percent {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-gold);
    font-variant-numeric: tabular-nums;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-red), var(--accent-gold));
    border-radius: var(--radius-full);
    transition: width 0.15s ease;
}

.progress-detail {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-top: var(--space-sm);
    text-align: center;
}

/* ---------- Download Section ---------- */
.download-section {
    text-align: center;
    padding: var(--space-xl) 0;
    animation: fadeSlideIn 0.4s ease-out;
}

.success-animation {
    margin-bottom: var(--space-lg);
}

.success-check {
    animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.check-path {
    stroke-dasharray: 60;
    stroke-dashoffset: 60;
    animation: drawCheck 0.5s ease-out 0.3s forwards;
}

@keyframes drawCheck {
    to { stroke-dashoffset: 0; }
}

.success-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    background: linear-gradient(135deg, #22c55e, #16a34a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.download-stats {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--space-xl);
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 14px 36px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    border: none;
    border-radius: var(--radius-lg);
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3);
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(34, 197, 94, 0.5);
}

.btn-reset {
    display: block;
    margin: var(--space-lg) auto 0;
}

/* ---------- Footer Navigation ---------- */
.wizard-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(8, 8, 12, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-subtle);
    padding: var(--space-md) var(--space-lg);
}

.wizard-footer {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    max-width: var(--max-width);
    margin: 0 auto;
    /* re-declare for centering */
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: calc(var(--max-width) + var(--space-lg) * 2);
    padding: var(--space-md) var(--space-lg);
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .glass-card {
        padding: var(--space-lg);
        border-radius: var(--radius-lg);
    }

    .header-inner {
        flex-direction: column;
        gap: var(--space-xs);
        align-items: flex-start;
    }

    .wizard-connector {
        width: 24px;
    }

    .step-label {
        font-size: 0.6rem;
    }

    .step-number {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }

    .mode-options {
        grid-template-columns: 1fr;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .mapping-row {
        flex-direction: column;
        align-items: stretch;
    }

    .mapping-field {
        flex: none;
    }

    .mapping-arrow {
        display: none;
    }
}

@media (max-width: 480px) {
    .upload-zone {
        padding: var(--space-xl) var(--space-md);
    }

    .wizard-nav {
        padding: 0 var(--space-md);
    }

    .wizard-content {
        padding: 0 var(--space-md);
    }
}

/* ---------- Utility ---------- */
.hidden {
    display: none !important;
}

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

.text-gold {
    color: var(--accent-gold);
}

.text-red {
    color: var(--accent-red-light);
}

.mt-md {
    margin-top: var(--space-md);
}

.mt-lg {
    margin-top: var(--space-lg);
}

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

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

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

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

/* ---------- Loading Pulse ---------- */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading-pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

.btn-details {
    margin-left: 10px;
    background: var(--bg-accent);
    color: #fff;
}

.details-container {
    margin-top: 20px;
    padding: 15px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
}

.details-item {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
}

.details-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-medium);
}

.details-item-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.details-item-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.details-item-firm {
    font-weight: 500;
    color: var(--accent-red);
}

.details-item-trainings {
    margin-top: 10px;
}

.details-item-training {
    padding: 5px 10px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.details-item-persons {
    margin-top: 10px;
}

.details-item-person {
    padding: 5px 10px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.details-navigation {
    margin-top: 20px;
    text-align: center;
}

#btn-back-to-main {
    background: var(--bg-accent);
    color: white;
}

/* ---------- Mapping Text Input ---------- */

.mapping-text-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-base);
}

.mapping-text-input:focus {
    border-color: var(--accent-red);
}

.mapping-text-input::placeholder {
    color: var(--text-tertiary);
    font-style: italic;
}

/* ---------- Header Right ---------- */

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

.btn-history-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: inherit;
}

.btn-history-toggle:hover {
    background: rgba(255,255,255,0.14);
    color: #fff;
}

/* ---------- History Page ---------- */

.history-page {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px;
    min-height: 80vh;
}

.hp-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 12px;
}

.hp-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary, #fff);
    margin: 0;
}

.btn-danger-sm {
    padding: 6px 14px;
    border: 1px solid rgba(239,68,68,0.4);
    border-radius: var(--radius-md);
    background: rgba(239,68,68,0.1);
    color: #ef4444;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: inherit;
}

.btn-danger-sm:hover {
    background: rgba(239,68,68,0.2);
    border-color: rgba(239,68,68,0.6);
}

/* Stats */

.hp-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.hp-stat-card {
    background: var(--bg-card, rgba(255,255,255,0.04));
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}

.hp-stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent-red, #C41E3A);
    line-height: 1;
    margin-bottom: 4px;
}

.hp-stat-label {
    font-size: 0.75rem;
    color: var(--text-tertiary, #888);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* Filters */

.hp-filters {
    background: var(--bg-card, rgba(255,255,255,0.03));
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 16px;
}

.hp-search-row {
    margin-bottom: 10px;
}

.hp-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-input, rgba(255,255,255,0.05));
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    color: var(--text-tertiary, #888);
    transition: border-color var(--transition-base);
}

.hp-search-box:focus-within {
    border-color: var(--accent-red);
}

.hp-search-input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-primary, #fff);
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
}

.hp-search-input::placeholder {
    color: var(--text-tertiary, #666);
}

.hp-filter-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.hp-filter-select {
    flex: 1;
    min-width: 140px;
    padding: 8px 10px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    background: var(--bg-input, rgba(255,255,255,0.05));
    color: var(--text-primary, #eee);
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: border-color var(--transition-base);
}

.hp-filter-select:focus {
    border-color: var(--accent-red);
}

.hp-filter-select option {
    background: #1a1a2e;
    color: #eee;
}

.hp-filter-reset {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-tertiary, #888);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.hp-filter-reset:hover {
    color: var(--text-primary, #fff);
    border-color: var(--text-tertiary);
}

/* Grouping Tabs */

.hp-group-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius-md);
    padding: 3px;
}

.hp-group-tab {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-tertiary, #888);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: inherit;
}

.hp-group-tab:hover {
    color: var(--text-secondary, #ccc);
}

.hp-group-tab.active {
    background: var(--accent-red, #C41E3A);
    color: #fff;
}

/* Results */

.hp-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hp-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-tertiary, #666);
}

.hp-empty p {
    margin-top: 12px;
    font-size: 0.9rem;
}

/* Group Section */

.hp-group-section {
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.hp-group-title {
    padding: 10px 16px;
    font-weight: 600;
    font-size: 0.88rem;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid var(--border-medium);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hp-group-title-name {
    color: var(--accent-gold, #D4A843);
}

.hp-group-title-name.hp-firm-title {
    color: var(--accent-red, #C41E3A);
}

.hp-group-title-count {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-tertiary, #888);
}

/* Entry */

.hp-entry {
    border-bottom: 1px solid var(--border-medium);
}

.hp-entry:last-child {
    border-bottom: none;
}

.hp-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background var(--transition-base);
    gap: 12px;
}

.hp-entry-header:hover {
    background: rgba(255,255,255,0.03);
}

.hp-entry-left {
    min-width: 0;
    flex: 1;
}

.hp-entry-firm {
    font-size: 0.78rem;
    color: var(--accent-red, #C41E3A);
    font-weight: 500;
    margin-bottom: 2px;
}

.hp-entry-training {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-primary, #eee);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hp-entry-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.hp-entry-meta {
    font-size: 0.72rem;
    color: var(--text-tertiary, #777);
    text-align: right;
    line-height: 1.4;
}

.hp-entry-count {
    background: var(--accent-red, #C41E3A);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 10px;
    white-space: nowrap;
}

.hp-entry-arrow {
    color: var(--text-tertiary, #666);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.hp-entry.open .hp-entry-arrow {
    transform: rotate(180deg);
}

.hp-entry-delete {
    background: none;
    border: none;
    color: var(--text-tertiary, #555);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: color var(--transition-base);
    display: flex;
    flex-shrink: 0;
    opacity: 0;
}

.hp-entry-download {
    background: none;
    border: none;
    color: var(--text-tertiary, #555);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: color var(--transition-base);
    display: flex;
    flex-shrink: 0;
    opacity: 0;
}

.hp-entry-header:hover .hp-entry-delete,
.hp-entry-header:hover .hp-entry-download {
    opacity: 1;
}

.hp-entry-download:hover {
    color: #22c55e;
}

.hp-entry-download--disabled {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
}

.hp-entry-download--disabled:hover {
    color: var(--text-tertiary, #555) !important;
}

.hp-entry-delete:hover {
    color: #ef4444;
}

/* Participants Panel */

.hp-participants {
    display: none;
    padding: 8px 16px 14px;
    background: rgba(255,255,255,0.015);
    border-top: 1px solid var(--border-medium);
}

.hp-entry.open .hp-participants {
    display: block;
}

.hp-participants-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-tertiary, #888);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.hp-participant-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hp-participant {
    padding: 5px 12px;
    background: var(--bg-input, rgba(255,255,255,0.06));
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--text-secondary, #ccc);
}

.hp-participant:hover {
    border-color: var(--accent-red);
    color: var(--text-primary, #fff);
}

.hp-participant--clickable {
    cursor: pointer;
    transition: all var(--transition-fast);
}

.hp-participant--clickable:hover {
    border-color: #22c55e;
    color: #22c55e;
    background: rgba(34, 197, 94, 0.08);
}

/* ---------- Footer ---------- */

.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 10px 16px;
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.35;
    transition: opacity var(--transition-base);
    pointer-events: none;
    z-index: 5;
}

.app-footer a {
    color: var(--text-tertiary, #888);
    text-decoration: none;
    font-weight: 600;
    pointer-events: auto;
}

.app-footer:hover {
    opacity: 0.8;
}
