/* AutoFactura Styles - Pure CSS */

:root {
    --primary: #2f438f;
    --primary-light: #4463c6;
    --primary-dark: #21336f;
    --accent: #f3a63a;
    --accent-soft: #ffe5b8;
    --success: #2ba869;
    --success-dark: #177649;
    --background: #f7f8fd;
    --surface: #ffffff;
    --text: #191c1d;
    --text-muted: #647089;
    --border: #dce3f2;
    --shadow: 0 22px 60px rgba(47, 67, 143, 0.12);
    --max-width: 960px;
}

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

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(243, 166, 58, 0.14), transparent 26%),
        radial-gradient(circle at top right, rgba(68, 99, 198, 0.14), transparent 24%),
        linear-gradient(180deg, #f5f7ff 0%, #fbfcff 48%, #fffaf1 100%);
    color: var(--text);
    line-height: 1.5;
}

body.sidebar-hidden .sidebar {
    display: none !important;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    display: none;
    width: 260px;
    background: linear-gradient(180deg, rgba(47, 67, 143, 0.98) 0%, rgba(40, 57, 122, 0.96) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    padding: 2rem 1.5rem;
    flex-shrink: 0;
    color: #fff;
}

.main-content {
    flex-grow: 1;
    width: 100%;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.content-wrapper {
    width: 100%;
    max-width: var(--max-width);
}

/* Sidebar Elements */
.logo-section {
    margin-bottom: 2.5rem;
    padding: 1.1rem;
    border-radius: 1.25rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.08));
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 18px 40px rgba(18, 27, 61, 0.2);
}

.logo-mark {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.sidebar-logo {
    width: 100%;
    max-width: 180px;
    border-radius: 1rem;
    background-color: #fff;
    padding: 0.55rem 0.8rem;
    object-fit: contain;
    box-shadow: 0 10px 28px rgba(14, 22, 52, 0.22);
}

.logo-copy h1 {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 800;
}

.logo-copy p {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.78);
}

.nav-menu {
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
    width: 100%;
    border: none;
    background: none;
    text-align: left;
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(243, 166, 58, 0.22), rgba(255, 255, 255, 0.12));
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.nav-item:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.nav-item svg {
    width: 1.15rem;
    height: 1.15rem;
}

.nav-item:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.hero-banner {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.6rem;
    border-radius: 1.6rem;
    background: linear-gradient(135deg, rgba(47, 67, 143, 0.97), rgba(68, 99, 198, 0.9));
    color: #fff;
    box-shadow: var(--shadow);
}

.hero-banner-intro {
    align-items: center;
    min-height: min(72vh, 680px);
    margin-top: clamp(1rem, 4vh, 3rem);
    margin-bottom: 0;
}

.hero-banner::after {
    content: "";
    position: absolute;
    inset: auto -5rem -5rem auto;
    width: 14rem;
    height: 14rem;
    border-radius: 50%;
    background: rgba(243, 166, 58, 0.18);
    filter: blur(4px);
}

.hero-copy {
    position: relative;
    z-index: 1;
}

.hero-kicker {
    display: inline-block;
    margin-bottom: 0.8rem;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.15);
    color: #fef4df;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-copy h1 {
    font-size: clamp(1.9rem, 4vw, 2.8rem);
    line-height: 1.05;
    margin-bottom: 0.9rem;
}

.hero-copy p {
    max-width: 38rem;
    color: rgba(255, 255, 255, 0.86);
    font-size: 1rem;
}

.hero-start-button {
    margin-top: 1.4rem;
}

.hero-actions {
    display: inline-flex;
    flex-direction: column;
    align-items: stretch;
    margin-top: 1.4rem;
}

.hero-actions .hero-start-button {
    margin-top: 0;
}

.hero-logo-card {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 120px;
    border-radius: 1.35rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.08));
    border: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(8px);
}

.hero-logo {
    width: min(100%, 320px);
    border-radius: 1rem;
    background-color: #fff;
    padding: 0.7rem 1rem;
    object-fit: contain;
    box-shadow: 0 16px 40px rgba(18, 27, 61, 0.18);
}

.hero-logo-company {
    padding: 0;
    background-color: transparent;
}

.hero-system-mark {
    display: inline-flex;
    align-items: center;
    align-self: flex-end;
    margin-top: 5rem;
    padding: 0.35rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
}

.hero-system-mark-logo {
    width: clamp(96px, 11vw, 138px);
    height: auto;
    border-radius: 0.75rem;
    display: block;
    box-shadow: 0 10px 24px rgba(18, 27, 61, 0.14);
}

.hero-system-badge {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 12px 28px rgba(18, 27, 61, 0.14);
}

.hero-system-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.hero-system-logo {
    width: 74px;
    height: 30px;
    border-radius: 999px;
    object-fit: cover;
    border: 1px solid rgba(47, 67, 143, 0.12);
}

.mobile-logo-banner {
    display: block;
    margin-bottom: 1.5rem;
}

.mobile-logo {
    display: block;
    width: min(100%, 260px);
    margin: 0 auto;
    padding: 0.6rem 0.9rem;
    border-radius: 1rem;
    background-color: #fff;
    box-shadow: 0 14px 32px rgba(47, 67, 143, 0.12);
}

/* Stepper */
.stepper {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin-bottom: 3rem;
    padding: 0 1rem;
}

.stepper::before {
    content: "";
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, rgba(68, 99, 198, 0.15), rgba(243, 166, 58, 0.5), rgba(68, 99, 198, 0.15));
    z-index: 0;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
    background-color: transparent;
    padding: 0 0.5rem;
}

.step-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #edf1fb;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.step.active .step-icon {
    background: linear-gradient(135deg, var(--accent-soft), #fff3da);
    color: var(--primary-dark);
    box-shadow: 0 10px 24px rgba(243, 166, 58, 0.28);
}

.step.completed .step-icon {
    background: linear-gradient(135deg, #dcf7ea, #f1fbf6);
    color: var(--success);
    box-shadow: 0 10px 24px rgba(43, 168, 105, 0.18);
}

.step-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
}

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

.step.completed .step-label {
    color: var(--success);
}

.step-icon svg {
    width: 1.15rem;
    height: 1.15rem;
}

/* Card Section */
.card {
    background-color: var(--surface);
    border-radius: 1.2rem;
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    border: 1px solid rgba(105, 128, 202, 0.18);
    border-top: 6px solid var(--primary-light);
}

.card h2 {
    color: var(--primary);
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    font-weight: 800;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.input-group label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.input-group input,
.form-input {
    width: 100%;
    padding: 1rem;
    border: 1px solid #d9e1f2;
    background-color: #fbfcff;
    border-radius: 0.85rem;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-input {
    min-height: 56px;
}

.form-select {
    appearance: none;
}

.text-uppercase {
    text-transform: uppercase;
}

.input-group input:focus,
.form-input:focus {
    outline: none;
    border-color: rgba(68, 99, 198, 0.55);
    box-shadow: 0 0 0 4px rgba(68, 99, 198, 0.12);
    background-color: #fff;
}

.form-message {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
}

.form-message-error {
    background-color: #ffebe9;
    color: #a61b1b;
}

.form-message-success {
    background-color: #e8f5e9;
    color: #1f6b3b;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border-radius: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: transform 0.1s, box-shadow 0.2s;
    width: 100%;
}

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

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

.btn-success {
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    color: white;
    box-shadow: 0 14px 28px rgba(43, 168, 105, 0.24);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #ef8d24);
    color: white;
    box-shadow: 0 14px 28px rgba(243, 166, 58, 0.28);
}

.btn-secondary {
    background: #eef2fb;
    color: var(--primary);
    border: 1px solid #d9e1f2;
}

/* Summary Section */
.summary-bar {
    background: linear-gradient(135deg, rgba(255, 248, 239, 0.96), rgba(255, 255, 255, 0.98));
    border-radius: 1.2rem;
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(243, 166, 58, 0.2);
    box-shadow: 0 16px 40px rgba(243, 166, 58, 0.08);
}

.summary-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.summary-info p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.summary-info h3 {
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary-dark);
}

.step-validation-message {
    color: #a61b1b;
    font-size: 0.95rem;
    font-weight: 600;
}

/* Tickets List */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1rem;
}

.list-header h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.list-header span {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--primary);
}

.ticket-item {
    background-color: var(--surface);
    padding: 1.25rem;
    border-radius: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    box-shadow: 0 12px 28px rgba(47, 67, 143, 0.08);
    border: 1px solid rgba(105, 128, 202, 0.14);
}

.card-header-inline {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.card-helper {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.ticket-resume {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #f3f6ff, #fff8ee);
    border-radius: 1rem;
    color: var(--primary);
    border: 1px solid rgba(105, 128, 202, 0.14);
}

.ticket-resume span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.review-total strong {
    font-size: 2rem;
    line-height: 1;
}

.receptor-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem 1.5rem;
}

.input-group-full {
    grid-column: 1 / -1;
}

.wizard-actions {
    display: flex;
    flex-direction: column-reverse;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.validation-summary {
    margin-bottom: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    background-color: #fff4e5;
    color: #8a4b00;
}

.validation-summary ul {
    margin-left: 1rem;
}

.validation-message {
    display: block;
    margin-top: 0.4rem;
    color: #ba1a1a;
    font-size: 0.85rem;
    font-weight: 600;
}

.review-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.review-panel {
    background: linear-gradient(180deg, rgba(249, 251, 255, 0.92), rgba(255, 255, 255, 0.96));
    border: 1px solid #e4ebf7;
    border-radius: 1rem;
    padding: 1.25rem;
}

.review-panel-wide {
    min-width: 0;
}

.review-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.review-panel-header h3 {
    color: var(--primary);
    font-size: 1rem;
    font-weight: 800;
}

.review-panel-header span {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 700;
}

.concepts-table-wrapper {
    overflow-x: auto;
}

.concepts-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 420px;
}

.concepts-table th,
.concepts-table td {
    padding: 0.9rem 0.75rem;
    border-bottom: 1px solid #e7ecef;
    text-align: left;
}

.concepts-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.concepts-table td {
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--text);
}

.concept-name {
    display: inline-block;
}

.concept-row-extra td {
    background-color: #fbfcfd;
}

.concept-name-extra {
    position: relative;
    padding-left: 1.5rem;
    color: var(--primary-light);
    font-weight: 700;
}

.concept-name-extra::before {
    content: "";
    position: absolute;
    left: 0.35rem;
    top: 50%;
    width: 0.7rem;
    height: 1px;
    background-color: #9fb7c7;
}

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

.review-data-list {
    display: grid;
    gap: 1rem;
}

.review-data-list div {
    padding-bottom: 0.85rem;
    border-bottom: 1px solid #e7ecef;
}

.review-data-list div:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.review-data-list dt {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.review-data-list dd {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    word-break: break-word;
}

.review-message {
    margin-top: 1rem;
    margin-bottom: 0;
}

.invoice-card {
    border-top-color: var(--success);
}

.invoice-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.invoice-status {
    background: linear-gradient(135deg, #e8f5e9, #fff8ee);
    border: 1px solid #d7eadc;
}

.invoice-status strong {
    font-size: 1.4rem;
    line-height: 1.1;
}

.invoice-actions-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.btn-action-tile {
    min-height: 120px;
    flex-direction: column;
    gap: 0.75rem;
    border-radius: 1rem;
}

.btn-action-tile svg,
.btn-email-placeholder svg {
    width: 1.35rem;
    height: 1.35rem;
}

.btn-action-tile span {
    font-size: 1rem;
}

.invoice-helper {
    margin-top: 1rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.btn-email-placeholder {
    margin-top: 1rem;
}

.invoice-summary-panel {
    margin-top: 1.5rem;
}

.empty-state {
    background-color: var(--surface);
    border-radius: 1rem;
    padding: 1.5rem;
    color: var(--text-muted);
    box-shadow: var(--shadow);
    border: 1px dashed rgba(105, 128, 202, 0.26);
}

.ticket-details {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.ticket-indicator {
    width: 4px;
    height: 40px;
    background: linear-gradient(180deg, var(--accent), var(--primary-light));
    border-radius: 2px;
}

.ticket-info p:first-child {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.ticket-info p:last-child {
    font-size: 1.125rem;
    font-weight: 700;
}

.delete-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 700;
}

.delete-btn:hover {
    background-color: #ffdad6;
    color: #ba1a1a;
}

/* Footer */
footer {
    width: 100%;
    padding: 2rem 0;
    margin-top: auto;
    border-top: 1px solid rgba(105, 128, 202, 0.16);
}

.footer-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.footer-copy {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-decoration: none;
}

/* Desktop Styles */
@media (min-width: 800px) {
    .sidebar {
        display: flex;
        flex-direction: column;
    }

    .main-content {
        padding: 3rem;
    }

    .hero-banner {
        grid-template-columns: minmax(0, 1.35fr) minmax(240px, 0.8fr);
        align-items: center;
        padding: 2rem 2.2rem;
    }

    .hero-banner-intro {
        min-height: min(76vh, 720px);
    }

    .mobile-logo-banner {
        display: none;
    }

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

    .btn {
        width: auto;
    }

    .summary-bar {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .summary-actions {
        width: auto;
        align-items: flex-end;
    }

    .card-header-inline {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }

    .receptor-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .review-grid {
        grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
        align-items: start;
    }

    .invoice-grid {
        grid-template-columns: minmax(0, 1.25fr) minmax(280px, 1fr);
        align-items: start;
    }

    .invoice-actions-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .wizard-actions {
        flex-direction: row;
        justify-content: space-between;
    }

    .footer-content {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}

@media (max-width: 799px) {
    .hero-banner-intro {
        min-height: calc(100vh - 8rem);
        align-content: center;
        text-align: center;
    }

    .hero-copy p {
        max-width: none;
    }

    .hero-start-button {
        width: 100%;
    }

    .hero-logo-card {
        min-height: auto;
    }

    .hero-actions {
        display: flex;
        width: 100%;
    }

    .hero-system-mark {
        align-self: center;
    }
}
