/* QuoteCatalog — FDR Abogados */
:root {
    --primary: #1a3a5c;
    --primary-light: #2c5f8a;
    --accent: #c9a94e;
    --accent-hover: #b8942e;
    --bg: #f5f6f8;
    --card: #ffffff;
    --text: #1a1a2e;
    --text-light: #6b7280;
    --border: #e2e4e9;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --radius: 10px;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
}

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

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

.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.header-logo .badge {
    background: var(--accent);
    color: var(--primary);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
}

.header-nav {
    display: flex;
    gap: 4px;
}

.header-nav a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.header-nav a:hover, .header-nav a.active {
    background: rgba(255,255,255,0.12);
    color: white;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* --- Pages --- */
.page { display: none; }
.page.active { display: block; }

/* --- Cotizador --- */
.cotizador-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    align-items: start;
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    border: 1px solid var(--border);
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Search & Filters */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-bar input {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border 0.2s;
}

.search-bar input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(44,95,138,0.1);
}

.search-bar select {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    outline: none;
}

/* Category groups */
.category-group {
    margin-bottom: 20px;
}

.category-header {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--border);
}

.product-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    gap: 12px;
}

.product-item:hover {
    background: #f0f2f5;
}

.product-item.selected {
    background: #e8f0fe;
    border-left: 3px solid var(--primary-light);
}

.product-item .info {
    flex: 1;
    min-width: 0;
}

.product-item .name {
    font-size: 14px;
    font-weight: 500;
}

.product-item .code {
    font-size: 11px;
    color: var(--text-light);
}

.product-item .price {
    font-weight: 700;
    color: var(--primary);
    font-size: 14px;
    white-space: nowrap;
}

.product-item .price-detail {
    font-size: 11px;
    color: var(--text-light);
    white-space: nowrap;
}

/* --- Carrito / Cart --- */
.cart-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.cart-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.cart-total {
    border-top: 2px solid var(--border);
    padding-top: 12px;
    margin-top: 12px;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 14px;
}

.cart-total-grande {
    display: flex;
    justify-content: space-between;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    padding-top: 8px;
    margin-top: 8px;
    border-top: 2px solid var(--primary);
}

.cart-items {
    list-style: none;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item .remove-btn {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.cart-item .remove-btn:hover {
    opacity: 1;
}

/* --- Form --- */
.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 4px;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border 0.2s;
}

.form-group input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(44,95,138,0.1);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-light);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-accent:hover {
    background: var(--accent-hover);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

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

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

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--bg);
}

.btn-block {
    width: 100%;
}

/* --- Dashboard Quotes Table --- */
.quotes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.quotes-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quotes-filters select, .quotes-filters input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    outline: none;
}

.quotes-table {
    width: 100%;
    border-collapse: collapse;
}

.quotes-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

.quotes-table td {
    padding: 12px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

.quotes-table tr:hover td {
    background: #f8f9fa;
}

.estado-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.estado-badge.borrador { background: #f3f4f6; color: #6b7280; }
.estado-badge.enviada { background: #dbeafe; color: #1d4ed8; }
.estado-badge.aprobada { background: #d1fae5; color: #065f46; }
.estado-badge.rechazada { background: #fee2e2; color: #991b1b; }

.actions-cell {
    display: flex;
    gap: 6px;
}

/* --- Modal / Toast --- */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 999;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }

/* --- Responsive --- */
@media (max-width: 900px) {
    .cotizador-layout {
        grid-template-columns: 1fr;
    }
    .header {
        padding: 0 12px;
    }
    .header-nav a {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* --- Loading --- */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Login Screen --- */
.login-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.login-overlay.hidden {
    display: none;
}
.login-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 40px;
    width: 380px;
    max-width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    text-align: center;
}
.login-card .logo {
    font-size: 36px;
    margin-bottom: 8px;
}
.login-card h1 {
    font-size: 22px;
    color: var(--primary);
    margin-bottom: 4px;
}
.login-card .subtitle {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 24px;
}
.login-card .form-group {
    text-align: left;
    margin-bottom: 16px;
}
.login-card .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 4px;
}
.login-card .form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border 0.2s;
}
.login-card .form-group input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(44,95,138,0.1);
}
.login-card .error-msg {
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 12px;
    min-height: 20px;
}
.login-card .btn {
    width: 100%;
    padding: 12px;
}
.header-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: rgba(255,255,255,0.9);
}
.header-user .logout-btn {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}
.header-user .logout-btn:hover {
    background: rgba(255,255,255,0.2);
}
