/* Reset y variables CSS */
:root {
    --primary-color: #1E3A8A;
    --secondary-color: #3B82F6;
    --background: #F8F9FA;
    --surface: #FFFFFF;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --border: #E5E7EB;
    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 0.375rem;
    --radius-lg: 0.75rem;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
}

/* Header */
.header {
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
}

.header .container {
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    height: 40px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
}

.company-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Header Minimalista para detalles */
.header-minimal {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
    box-shadow: var(--shadow-sm);
}

.header-minimal .container {
    padding: 0 1.5rem;
}

.header-minimal-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-minimal-left {
    display: flex;
    align-items: center;
}

.logo-minimal {
    height: 35px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
}

.header-minimal-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-minimal {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-primary);
}

.btn-minimal:hover {
    background: var(--background);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-help {
    color: var(--text-secondary);
}

.btn-help:hover {
    color: var(--warning);
    border-color: var(--warning);
}

.btn-new {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-new:hover {
    background: var(--primary-color);
    color: white;
}

.btn-icon-minimal {
    width: 18px;
    height: 18px;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 0;
    background: var(--background);
}

.page-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
}

/* Layout con sidebar */
.layout-with-sidebar {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 0;
    min-height: calc(100vh - 82px - 60px); /* header + footer */
}

.document-view {
    background: var(--surface);
    padding: 0;
    overflow-y: auto;
}

.sidebar {
    background: var(--surface);
    border-left: 1px solid var(--border);
    padding: 1.75rem 1.5rem;
    overflow-y: auto;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.05);
}

/* Layout centrado simple */
.layout-centered {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.breadcrumb-link {
    color: var(--secondary-color);
    text-decoration: none;
}

.breadcrumb-link:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--text-secondary);
}

.breadcrumb-current {
    color: var(--text-secondary);
}

/* Welcome Section */
.welcome-section {
    text-align: center;
    margin-bottom: 1rem;
    backdrop-filter: blur(5px);
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    letter-spacing: -0.02em;
}

.page-title-highlight {
    font-size: 2rem;
    font-weight: 700;
    color: #FFFFFF;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 255, 255, 0.3);
}

.subtitle {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.125rem;
    font-weight: 400;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.alert-error {
    background: #FEE2E2;
    border: 1px solid #FCA5A5;
    color: #991B1B;
}

.alert-icon {
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
}

/* Cards */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

/* Documento/Factura estilo papel */
.document-paper {
    background: var(--surface);
    border-radius: 0;
    box-shadow: none;
    padding: 2rem 2.5rem;
    width: 100%;
    height: 100%;
    min-height: calc(100vh - 82px - 60px);
}

.document-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.document-logo {
    height: 42px;
}

.document-type {
    text-align: right;
}

.document-type-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
    line-height: 1.2;
}

.document-type-subtitle {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.card-header {
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.card-description {
    color: var(--text-secondary);
}

/* Forms */
.form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    font-weight: 500;
    color: var(--text-primary);
}

.required {
    color: var(--error);
}

.form-input,
.form-select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: all 0.2s;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-help {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.input-with-prefix {
    position: relative;
    display: flex;
    align-items: center;
}

.input-prefix {
    position: absolute;
    left: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.input-with-prefix-field {
    padding-left: 2.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: #1e40af;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Info Section */
.info-section {
    margin-top: 2rem;
}

.info-card {
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
}

.info-icon {
    width: 2rem;
    height: 2rem;
    color: var(--secondary-color);
    flex-shrink: 0;
}

.info-title {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.info-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-list li {
    color: var(--text-secondary);
}

/* Tables */
.details-table,
.cfdi-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.75rem;
    font-size: 0.875rem;
}

.details-table th,
.details-table td,
.cfdi-table th,
.cfdi-table td {
    padding: 0.75rem 0.625rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.details-table th,
.cfdi-table th {
    background: var(--background);
    font-weight: 600;
    color: var(--text-primary);
}

/* Totales dentro de la tabla CFDI */
.cfdi-table .totals-spacer td {
    padding: 0.5rem;
    border-bottom: none;
}

.cfdi-table .totals-row td {
    border-bottom: none;
    padding: 0.5rem 0.625rem;
    font-weight: 500;
}

.cfdi-table .totals-row .totals-label {
    text-align: right;
    color: var(--text-secondary);
}

.cfdi-table .totals-row .totals-value {
    text-align: right;
    font-weight: 600;
    color: var(--text-primary);
}

.cfdi-table .totals-row.total-row td {
    padding-top: 0.75rem;
    border-top: 2px solid var(--primary-color);
    font-size: 1.125rem;
}

.cfdi-table .totals-row.total-row .totals-label,
.cfdi-table .totals-row.total-row .totals-value {
    color: var(--primary-color);
    font-weight: 700;
}

.details-table tfoot td {
    border-top: 2px solid var(--border);
}

.total-row td {
    font-size: 1.125rem;
    color: var(--primary-color);
}

.text-right {
    text-align: right;
}

/* Ticket Summary */
.ticket-summary-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

.ticket-date {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* CFDI Styles */
.success-message {
    text-align: center;
    padding: 2rem;
    margin-bottom: 2rem;
}

.success-icon {
    width: 4rem;
    height: 4rem;
    color: var(--success);
    margin: 0 auto 1rem;
}

.success-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 0.5rem;
}

.success-subtitle {
    color: var(--text-secondary);
}

.cfdi-container {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    margin-bottom: 2rem;
}

.cfdi-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 3px solid var(--primary-color);
}

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

.cfdi-info {
    text-align: right;
}

.cfdi-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.cfdi-folio {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.cfdi-uuid {
    font-family: monospace;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.cfdi-parties {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.party-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

.party-details p {
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
}

.cfdi-general {
    background: var(--background);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.general-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.general-row:last-child {
    margin-bottom: 0;
}

.general-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.general-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.general-value {
    font-weight: 500;
    color: var(--text-primary);
}

.cfdi-section {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.cfdi-totals {
    background: var(--background);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-top: 2rem;
}

/* Totales del ticket - alineados a la derecha */
.ticket-totals {
    max-width: 400px;
    margin-left: auto;
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--background);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.totals-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.totals-row.total {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    border-bottom: none;
    border-top: 2px solid var(--primary-color);
    margin-top: 0.5rem;
    padding-top: 1rem;
}

.seal-info {
    background: var(--background);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.seal-item {
    margin-bottom: 1rem;
}

.seal-item:last-child {
    margin-bottom: 0;
}

.seal-text {
    font-family: monospace;
    font-size: 0.875rem;
    color: var(--text-secondary);
    word-break: break-all;
    margin-top: 0.25rem;
}

.seal-text.small {
    font-size: 0.75rem;
}

.cfdi-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border);
    text-align: center;
}

.legal-notice {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

/* Footer */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    margin-top: auto;
    text-align: center;
    color: var(--text-secondary);
}

.footer .container {
    padding: 0 1.5rem;
}

.footer-rfc {
    margin-top: 0.25rem;
    font-size: 0.875rem;
}

/* Sidebar Styles */
.sidebar-header {
    margin-bottom: 1.5rem;
}

.sidebar-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.sidebar-description {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.step-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    font-weight: 700;
    font-size: 0.875rem;
}

.step-info {
    flex: 1;
}

.step-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.step-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0.125rem;
}

/* Data Sections en documento */
.data-section {
    margin-bottom: 1.5rem;
}

.section-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem 1.5rem;
}

.data-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.data-label {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.data-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    color: var(--text-secondary);
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state-description {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 1024px) {
    .layout-with-sidebar {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        border-left: none;
        border-top: 1px solid var(--border);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    }
    
    .document-view {
        padding: 0;
    }
    
    .document-paper {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0.75rem 0;
    }
    
    .header .container {
        padding: 0 1rem;
    }
    
    .logo {
        height: 30px;
        max-width: 120px;
    }
    
    .company-name {
        font-size: 1rem;
    }
    
    .header-minimal {
        padding: 0.5rem 0;
    }
    
    .logo-minimal {
        height: 28px;
    }
    
    .btn-minimal {
        padding: 0.4rem 0.75rem;
        font-size: 0.8125rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .document-paper {
        padding: 1.5rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .data-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .cfdi-container {
        padding: 1.5rem;
    }
    
    .cfdi-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .cfdi-info {
        text-align: left;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .document-header-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .document-type {
        text-align: left;
    }
    
    .document-view {
        padding: 1rem;
    }
    
    .details-table,
    .cfdi-table {
        font-size: 0.8125rem;
    }
    
    .details-table th,
    .details-table td,
    .cfdi-table th,
    .cfdi-table td {
        padding: 0.625rem 0.5rem;
    }
}

/* Modal de errores */
.error-modal-button:hover {
    background: #dc2626 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.3);
}

.error-modal-button:active {
    transform: translateY(0);
}

/* Updated: Mon Dec  1 17:58:00 CST 2025 */
