/* Sistema de Facturación - Estilos Completos */
/* Colores: Azul Rey y Blanco */

:root {
    --primary-color: #1e3a8a;          /* Azul rey principal */
    --primary-dark: #003366;           /* Azul rey oscuro */
    --primary-light: #3b5bdb;          /* Azul rey claro */
    --primary-very-light: #e6efff;     /* Azul muy claro para fondos */
    --white: #ffffff;
    --text-color: #003366;             /* Texto principal */
    --text-secondary: #1e3a8a;         /* Texto secundario */
    --border-color: #c7d9ff;           /* Bordes azul claro */
    --shadow: rgba(30, 58, 138, 0.1);
    --shadow-hover: rgba(30, 58, 138, 0.2);
}

/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--primary-very-light) 0%, var(--white) 100%);
    min-height: 100vh;
    color: var(--text-color);
    line-height: 1.6;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background: var(--white);
    box-shadow: 0 2px 4px var(--shadow);
    padding: 1rem 0;
    border-bottom: 2px solid var(--border-color);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin: 0;
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-btn {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: var(--white);
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.3s;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

.nav-btn:hover {
    background: var(--primary-dark);
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Dashboard */
.dashboard {
    text-align: center;
    padding: 3rem 2rem;
}

.dashboard h2 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.dashboard-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
}

.dashboard-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.action-card {
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s;
    box-shadow: 0 2px 4px var(--shadow);
}

.action-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px var(--shadow-hover);
    transform: translateY(-2px);
}

.action-card h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.action-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Form Container */
.form-container {
    background: var(--white);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 8px var(--shadow);
    margin-bottom: 2rem;
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.form-header h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin: 0;
}

.form-header > div {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-weight: 500;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    color: var(--text-color);
    background: var(--white);
    transition: border-color 0.3s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* Type Selection Cards */
.type-selection-inline {
    margin-top: 1rem;
}

.type-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.type-card {
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.type-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 8px var(--shadow);
}

.type-card.selected {
    border-color: var(--primary-color);
    background: var(--primary-very-light);
}

.type-card h3 {
    font-size: 1.25rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.type-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 8px var(--shadow-hover);
}

.btn-secondary {
    background: var(--white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-very-light);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: var(--white);
}

.btn-danger {
    background: #dc2626;
    color: var(--white);
    padding: 0.25rem 0.5rem;
    font-size: 1.25rem;
    line-height: 1;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* Items Table */
.items-section {
    margin: 2rem 0;
}

.items-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: var(--white);
    box-shadow: 0 2px 4px var(--shadow);
}

.items-table thead {
    background: var(--primary-color);
    color: var(--white);
}

.items-table th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
}

.items-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.items-table tbody tr:nth-child(even) {
    background: var(--primary-very-light);
}

.items-table tbody tr:hover {
    background: #d4e4ff;
}

.items-table input {
    width: 100%;
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.items-table input.center {
    text-align: center;
}

.items-table .col-desc {
    width: 35%;
}

.items-table .col-qty {
    width: 8%;
}

.items-table .col-price {
    width: 12%;
}

.items-table .col-discount {
    width: 10%;
}

.items-table .col-tax {
    width: 8%;
}

.items-table .col-irpf {
    width: 10%;
}

.items-table .col-total {
    width: 12%;
    font-weight: bold;
    color: var(--primary-color);
}

.items-table .col-actions {
    width: 5%;
    text-align: center;
}

/* Totals Section */
.totals-section {
    margin: 2rem 0;
    display: flex;
    justify-content: flex-end;
}

.totals-table {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    background: var(--white);
    min-width: 300px;
}

.totals-table td {
    padding: 0.5rem 1rem;
    text-align: right;
}

.totals-table td:first-child {
    text-align: left;
    color: var(--text-color);
    font-weight: 500;
}

.totals-table .total-row {
    border-top: 2px solid var(--primary-color);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}

.totals-table .total-row td {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--primary-color);
    padding: 0.75rem 1rem;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 4px;
}

.totals-table .total-row td:first-child {
    background: var(--primary-color);
    color: var(--white);
}

/* Logo Upload */
.logo-upload {
    margin-top: 0.5rem;
}

.logo-upload input[type="file"] {
    padding: 0.5rem;
    border: 1px dashed var(--border-color);
    border-radius: 4px;
    width: 100%;
    background: var(--primary-very-light);
}

.logo-preview {
    margin-top: 1rem;
}

.logo-preview img {
    max-width: 200px;
    max-height: 200px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem;
    background: var(--white);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem 1.5rem;
    box-shadow: 0 4px 12px var(--shadow-hover);
    min-width: 300px;
    animation: slideIn 0.3s ease-out;
}

.toast.success {
    border-color: #10b981;
    background: #ecfdf5;
}

.toast.error {
    border-color: #dc2626;
    background: #fef2f2;
}

.toast.info {
    border-color: var(--primary-color);
    background: var(--primary-very-light);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Footer */
.main-footer {
    background: var(--white);
    border-top: 2px solid var(--border-color);
    padding: 1.5rem 0;
    margin-top: auto;
    box-shadow: 0 -2px 4px var(--shadow);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
}

.footer-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.footer-content a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .main-content {
        padding: 0 1rem;
    }
    
    .form-container {
        padding: 1rem;
    }
    
    .form-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .form-header > div {
        width: 100%;
        flex-direction: column;
    }
    
    .form-header > div .btn {
        width: 100%;
    }
    
    .dashboard-actions {
        grid-template-columns: 1fr;
    }
    
    .type-cards {
        grid-template-columns: 1fr;
    }
    
    .items-table {
        font-size: 0.85rem;
    }
    
    .items-table th,
    .items-table td {
        padding: 0.4rem;
    }
    
    .totals-section {
        justify-content: stretch;
    }
    
    .totals-table {
        width: 100%;
    }
    
    .toast-container {
        left: 10px;
        right: 10px;
        top: 10px;
    }
    
    .toast {
        min-width: auto;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .dashboard h2 {
        font-size: 2rem;
    }
    
    .form-header h2 {
        font-size: 1.5rem;
    }
    
    .items-table {
        display: block;
        overflow-x: auto;
    }
}

/* View Management */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* Utility Classes */
.center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 {
    margin-top: 1rem;
}

.mb-1 {
    margin-bottom: 1rem;
}

/* Print Styles */
@media print {
    .navbar,
    .form-header,
    .btn,
    .toast-container {
        display: none;
    }
    
    .main-content {
        margin: 0;
        padding: 0;
    }
    
    .form-container {
        box-shadow: none;
        padding: 0;
    }
}


