/* ERGOraport - Kolorystyka ERGO */

:root {
    /* Kolory ERGO */
    --ergo-red: #BA1019;
    --ergo-red-dark: #8a0c13;
    --ergo-red-light: #d41a24;
    --ergo-black: #000000;
    --ergo-white: #ffffff;
    
    /* Tła */
    --bg-primary: #fafafa;
    --bg-card: #ffffff;
    --bg-dark: #1a1a1a;
    
    /* Tekst */
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: #999999;
    
    /* Obramowania */
    --border-color: #e0e0e0;
    --border-light: #f0f0f0;
    
    /* Cienie */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --shadow-red: 0 4px 20px rgba(186, 16, 25, 0.25);
}

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

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

.app-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 40px 24px;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 48px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
}

.logo-img {
    height: 60px;
    width: auto;
}

.logo-text {
    font-size: 36px;
    font-weight: 700;
    color: var(--ergo-red);
    letter-spacing: -1px;
}

.tagline {
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 400;
}

/* Upload Section */
.upload-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    margin-bottom: 40px;
}

/* ===== PRZEŁĄCZNIK DOM / FIRMA ===== */
.client-type-switch {
    display: flex;
    gap: 12px;
    padding: 8px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
}

.type-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-secondary);
    transition: all 0.25s ease;
}

.type-btn svg {
    stroke: currentColor;
    transition: all 0.25s ease;
}

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

.type-btn.active {
    background: var(--ergo-red);
    color: white;
    border-color: var(--ergo-red);
    box-shadow: var(--shadow-red);
}

.type-btn.active svg {
    stroke: white;
}

/* Info pod przełącznikiem */
.client-type-info {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: -8px;
}

.client-type-info.home-info::before {
    content: "🏠 ";
}

.client-type-info.business-info::before {
    content: "🏢 ";
}

@media (max-width: 480px) {
    .type-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .type-btn span {
        display: none;
    }
    
    .type-btn svg {
        width: 28px;
        height: 28px;
    }
}

.upload-area {
    width: 100%;
    max-width: 560px;
    padding: 48px 40px;
    background: var(--bg-card);
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: var(--shadow-sm);
}

.upload-area:hover {
    border-color: var(--ergo-red);
    box-shadow: var(--shadow-md);
}

.upload-area.drag-over {
    border-color: var(--ergo-red);
    background: rgba(186, 16, 25, 0.03);
    transform: scale(1.01);
}

.upload-area.has-file {
    border-color: var(--ergo-red);
    border-style: solid;
    background: rgba(186, 16, 25, 0.02);
}

.upload-icon {
    color: var(--ergo-red);
    margin-bottom: 16px;
}

.upload-area h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

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

.file-info {
    margin-top: 20px;
    padding: 12px 20px;
    background: rgba(186, 16, 25, 0.08);
    border-radius: 8px;
    color: var(--ergo-red);
    font-weight: 500;
    font-size: 14px;
    display: none;
}

.file-info.show {
    display: block;
}

/* Generate Button */
.generate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 36px;
    background: var(--ergo-red);
    border: none;
    border-radius: 10px;
    color: var(--ergo-white);
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    opacity: 0.4;
    pointer-events: none;
}

.generate-btn svg {
    stroke: currentColor;
}

.generate-btn:not(:disabled) {
    opacity: 1;
    pointer-events: auto;
}

.generate-btn:not(:disabled):hover {
    background: var(--ergo-red-dark);
    box-shadow: var(--shadow-red);
    transform: translateY(-2px);
}

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

/* Progress Section */
.progress-section {
    max-width: 560px;
    margin: 0 auto 40px;
}

.progress-bar {
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: var(--ergo-red);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Result Section */
.result-section, .error-section {
    max-width: 560px;
    margin: 0 auto 40px;
}

.result-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.result-card.success {
    border-top: 4px solid var(--ergo-red);
}

.result-card.success .result-icon {
    color: var(--ergo-red);
}

.result-card.error {
    border-top: 4px solid #dc3545;
}

.result-card.error .result-icon {
    color: #dc3545;
}

.result-icon {
    margin-bottom: 20px;
}

.result-card h3 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
}

.result-card p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
}

.action-btn.primary {
    background: var(--ergo-red);
    color: var(--ergo-white);
}

.action-btn.primary:hover {
    background: var(--ergo-red-dark);
    box-shadow: var(--shadow-red);
}

.action-btn.secondary {
    background: transparent;
    border: 2px solid var(--ergo-red);
    color: var(--ergo-red);
}

.action-btn.secondary:hover {
    background: rgba(186, 16, 25, 0.05);
}

.action-btn.tertiary {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
}

.action-btn.tertiary:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* Compact Result Card */
.result-card.compact {
    padding: 24px 32px;
}

.result-card.compact .result-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 20px;
}

.result-card.compact .result-header svg {
    color: var(--ergo-red);
    flex-shrink: 0;
}

.result-card.compact .result-text {
    text-align: left;
}

.result-card.compact .result-text h3 {
    font-size: 18px;
    margin-bottom: 4px;
}

.result-card.compact .result-text p {
    font-size: 12px;
    margin-bottom: 0;
    color: var(--text-muted);
}

.result-card.compact .result-actions {
    gap: 10px;
}

.result-card.compact .action-btn {
    padding: 10px 18px;
    font-size: 13px;
}

/* Help Accordion */
.help-accordion {
    margin-bottom: 24px;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

/* Uwypuklony styl dla ważnej instrukcji */
.help-accordion.help-prominent {
    border: 3px solid var(--ergo-red);
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(186, 16, 25, 0.15);
    animation: pulse-border 2s ease-in-out 3;
}

@keyframes pulse-border {
    0%, 100% { box-shadow: 0 4px 20px rgba(186, 16, 25, 0.15); }
    50% { box-shadow: 0 4px 30px rgba(186, 16, 25, 0.35); }
}

.help-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    list-style: none;
}

.help-toggle::-webkit-details-marker {
    display: none;
}

.help-icon {
    font-size: 20px;
}

.help-title {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
}

.help-badge {
    background: var(--ergo-red);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.help-toggle:hover {
    background: rgba(186, 16, 25, 0.05);
}

.help-accordion[open] .help-toggle {
    border-radius: 10px 10px 0 0;
    background: var(--ergo-red);
}

.help-accordion[open] .help-title {
    color: white;
}

.help-accordion[open] .help-badge {
    background: white;
    color: var(--ergo-red);
}

.help-accordion.help-prominent[open] {
    border-color: var(--ergo-red);
}

.help-content {
    background: var(--bg-card);
    border: none;
    border-top: 2px solid rgba(186, 16, 25, 0.1);
    border-radius: 0 0 10px 10px;
    padding: 24px 24px;
}

.help-prominent .help-content {
    background: linear-gradient(180deg, rgba(186, 16, 25, 0.03) 0%, var(--bg-card) 100%);
}

.help-steps {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.help-steps li {
    position: relative;
    padding-left: 36px;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.help-steps li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.help-steps li::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 24px;
    height: 24px;
    background: var(--ergo-red);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-steps li strong {
    color: var(--text-primary);
}

.help-steps li a {
    color: var(--ergo-red);
    text-decoration: none;
    font-weight: 500;
}

.help-steps li a:hover {
    text-decoration: underline;
}

.help-options {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 10px;
    background: rgba(186, 16, 25, 0.08);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--ergo-red);
}

.help-image {
    margin-top: 12px;
    text-align: center;
}

.instruction-image {
    max-width: 200px;
    height: auto;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.instruction-image:hover {
    box-shadow: var(--shadow-md);
    transform: scale(1.03);
}

/* Features Section */
.features-section {
    margin-top: 60px;
}

.features-section h3 {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 32px;
    color: var(--text-primary);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 24px;
    transition: all 0.25s ease;
    box-shadow: var(--shadow-sm);
}

.feature-card:hover {
    border-color: var(--ergo-red);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.feature-icon {
    color: var(--ergo-red);
    margin-bottom: 12px;
}

.feature-card h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

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

/* Footer */
.app-footer {
    margin-top: 60px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
}

.app-footer .beta-notice {
    margin-top: 8px;
    padding: 10px 16px;
    background: rgba(186, 16, 25, 0.08);
    border: 1px solid var(--ergo-red);
    border-radius: 6px;
    color: var(--ergo-red-dark);
    font-size: 12px;
    display: inline-block;
}

.app-footer .beta-notice a {
    color: var(--ergo-red);
    font-weight: 600;
}

/* Image lightbox */
.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

.lightbox-overlay img {
    max-width: 95%;
    max-height: 95%;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: 300;
    cursor: pointer;
    transition: opacity 0.2s;
}

.lightbox-close:hover {
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        padding: 24px 16px;
    }
    
    .logo-text {
        font-size: 28px;
    }
    
    .upload-area {
        padding: 32px 24px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
        justify-content: center;
    }
    
    .help-toggle {
        font-size: 13px;
        padding: 12px 16px;
    }
    
    .help-content {
        padding: 16px;
    }
    
    .help-steps li {
        padding-left: 32px;
        font-size: 13px;
    }
    
    .instruction-image {
        max-width: 150px;
    }
}

/* ===== SEKCJA EMAIL - KOMPAKTOWA Z OBRAMOWANIEM ===== */
.email-section {
    width: 100%;
    max-width: 560px;
    margin-top: 16px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.email-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.email-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.email-label svg {
    color: var(--ergo-red);
    width: 16px;
    height: 16px;
}

.email-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
    background: white;
}

.email-input:focus {
    border-color: var(--ergo-red);
    box-shadow: 0 0 0 2px rgba(186, 16, 25, 0.1);
}

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

.email-hint {
    display: none;
}

/* Checkbox zgody - kompaktowy */
.consent-wrapper {
    margin-top: 10px;
}

.consent-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.consent-checkbox {
    display: none;
}

.consent-checkmark {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--border-color);
    border-radius: 3px;
    background: white;
    position: relative;
    transition: all 0.2s;
}

.consent-checkbox:checked + .consent-checkmark {
    background: var(--ergo-red);
    border-color: var(--ergo-red);
}

.consent-checkbox:checked + .consent-checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.consent-label:hover .consent-checkmark {
    border-color: var(--ergo-red);
}

.consent-text {
    flex: 1;
}

/* Responsywność email */
@media (max-width: 640px) {
    .email-section {
        padding: 12px 16px;
    }
    
    .email-input-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .email-input {
        min-width: auto;
    }
    
    .consent-label {
        font-size: 11px;
    }
}
