/* ============================================
   SALES SECTION STYLES
   ============================================ */

/* ---- Sale List Page ---- */

.sale-list-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.sale-stat-card {
    background: #ffffff;
    border-radius: 10px;
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
}
.sale-stat-card:hover {
    border-color: #d1d5db;
}
.sale-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.sale-stat-icon.blue { background: #eff6ff; color: #2563eb; }
.sale-stat-icon.green { background: #ecfdf5; color: #059669; }
.sale-stat-icon.orange { background: #fef3c7; color: #d97706; }
.sale-stat-icon.purple { background: #ede9fe; color: #7c3aed; }

.sale-stat-info { display: flex; flex-direction: column; }
.sale-stat-number {
    font-size: 22px;
    font-weight: 600;
    color: #111827;
    line-height: 1.2;
}
.sale-stat-label {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 500;
}

/* Sale List Card */
.sale-list-card {
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}
.sale-list-card .table-container {
    margin: 0;
}
.sale-list-card table.table {
    margin-bottom: 0;
}
.sale-list-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.sale-list-header .sale-search-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    max-width: 500px;
}

.sale-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
}
.sale-search-wrapper .sale-search-icon {
    position: absolute;
    left: 1rem;
    color: #94a3b8;
    pointer-events: none;
    font-size: 0.95rem;
    z-index: 1;
}
.sale-search-wrapper input {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.75rem;
    font-size: 13px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    transition: all 0.15s ease;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
}
.sale-search-wrapper input:focus {
    border-color: #2563eb;
    box-shadow: none;
}
.sale-search-wrapper input::placeholder {
    color: #94a3b8;
}

.sale-list-card table.table thead tr {
    background: #f9fafb !important;
}
.sale-list-card table.table thead th {
    color: #9ca3af !important;
    font-weight: 600;
    padding: 12px 16px !important;
    border-bottom: 1px solid #e5e7eb !important;
    font-size: 11px !important;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.sale-list-card table.table tbody tr {
    transition: all 0.15s ease;
    border-bottom: 1px solid #f3f4f6;
}
.sale-list-card table.table tbody tr:hover {
    background-color: #fafafa !important;
}
.sale-list-card table.table tbody tr:nth-child(even) {
    background-color: transparent !important;
}
.sale-list-card table.table tbody tr:nth-child(even):hover {
    background-color: #fafafa !important;
}
.sale-list-card table.table td {
    padding: 14px 16px !important;
    vertical-align: middle !important;
    color: #374151 !important;
    font-size: 13px !important;
}

.btn-sale-options {
    transition: all 0.15s ease !important;
    border: 1px solid #e5e7eb !important;
    background: #fff !important;
    color: #9ca3af !important;
    width: 30px !important;
    height: 30px !important;
    padding: 0 !important;
    border-radius: 6px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}
.btn-sale-options:hover {
    border-color: #2563eb !important;
    color: #2563eb !important;
    background: #fff !important;
}
.btn-sale-options.is-danger:hover {
    border-color: #dc2626 !important;
    color: #dc2626 !important;
    background: #fef2f2 !important;
}
.page-content a.button.is-link.is-rounded.is-small {
    transition: all 0.15s ease;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #9ca3af;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.page-content a.button.is-link.is-rounded.is-small:hover {
    border-color: #2563eb;
    color: #2563eb;
    background: #fff;
}

.sale-list-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    background: #fff;
}
.sale-list-footer .pagination-info {
    font-size: 0.85rem;
    color: #64748b;
}
.sale-list-footer .pagination {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}
.sale-list-footer .pagination a,
.sale-list-footer .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 4px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #6b7280;
    text-decoration: none;
    transition: all 0.15s ease;
}
.sale-list-footer .pagination a:hover {
    border-color: #2563eb;
    color: #2563eb;
}
.sale-list-footer .pagination .is-active {
    background: #111827;
    color: #fff;
    border-color: #111827;
}

.sale-list-notification {
    background: #ffffff;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e5e7eb;
}

/* ---- New Sale Page ---- */

.sale-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.5rem;
    align-items: start;
}
.sale-main {
    min-width: 0;
}

.sale-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    position: relative;
}
.sale-search-icon {
    position: absolute;
    left: 1rem;
    color: #94a3b8;
    pointer-events: none;
    z-index: 1;
}
#sale-product-search-input {
    flex: 1;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    font-size: 13px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    transition: all 0.15s ease;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
}
#sale-product-search-input:focus {
    border-color: #2563eb;
}
#sale-product-search-input::placeholder {
    color: #94a3b8;
}
#sale-product-search-input[data-loading="true"] {
    background-image: linear-gradient(90deg, rgba(255,255,255,0.6), rgba(255,255,255,0.25));
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px 18px;
}
.sale-search-btn {
    padding: 0.75rem 1.25rem;
    background: #111827;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sale-search-btn:hover {
    background: #374151;
}

#sale-autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 60px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px !important;
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
    overflow: hidden;
    z-index: 9999;
    display: none;
    margin-top: 4px !important;
    padding: 0 !important;
}
#sale-autocomplete-list .autocomplete-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
    transition: background 0.1s ease;
}
#sale-autocomplete-list .autocomplete-item:last-child {
    border-bottom: none;
}
#sale-autocomplete-list .autocomplete-item:hover,
#sale-autocomplete-list .autocomplete-item.is-active {
    background: #f0f7ff;
}
#sale-autocomplete-list .autocomplete-item .name {
    font-weight: 500;
    color: #1e293b;
}
#sale-autocomplete-list .autocomplete-item .meta {
    color: #64748b;
    font-size: 0.85rem;
}
#sale-autocomplete-list .autocomplete-empty {
    padding: 14px;
    text-align: center;
    color: #94a3b8;
}
#sale-autocomplete-list mark {
    background: rgba(255, 200, 50, 0.4);
    padding: 0 2px;
    border-radius: 2px;
}

.sale-cart {
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}
.sale-cart table {
    width: 100%;
    border-collapse: collapse;
}
.sale-cart table thead tr {
    background: #f9fafb;
}
.sale-cart table thead th {
    padding: 12px 14px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #9ca3af;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}
.sale-cart table tbody tr {
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s ease;
}
.sale-cart table tbody tr:last-child {
    border-bottom: none;
}
.sale-cart table tbody tr:hover {
    background: #fafafa;
}
.sale-cart table td {
    padding: 14px 14px;
    vertical-align: middle;
    color: #374151;
    font-size: 13px;
}
.sale-cart .col-num {
    width: 40px;
    text-align: center;
    color: #94a3b8;
}
.sale-cart .col-product {
    min-width: 160px;
}
.sale-cart .col-qty {
    width: 140px;
}
.sale-cart .col-price {
    width: 110px;
    text-align: right;
    font-weight: 600;
}
.sale-cart .col-subtotal {
    width: 120px;
    text-align: right;
    font-weight: 600;
    color: #0066ff;
}
.sale-cart .col-action {
    width: 44px;
    text-align: center;
}
.sale-cart .product-name {
    display: block;
    font-weight: 600;
    color: #1e293b;
    font-size: 0.9rem;
}
.sale-cart .product-code {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 2px;
}

.qty-control {
    display: inline-flex;
    align-items: center;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    background: #ffffff;
}
.qty-btn {
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: all 0.15s ease;
}
.qty-btn:hover {
    background: #f1f5f9;
    color: #0066ff;
}
.qty-btn:active {
    background: #e2e8f0;
}
.qty-input {
    width: 48px;
    height: 34px;
    text-align: center;
    border: none;
    border-left: 1.5px solid #e2e8f0;
    border-right: 1.5px solid #e2e8f0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #0a1628;
    background: #ffffff;
    outline: none;
    font-family: inherit;
    -moz-appearance: textfield;
    appearance: textfield;
    box-sizing: border-box;
}
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.btn-remove {
    width: 34px;
    height: 34px;
    border: 1.5px solid transparent;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    color: #cbd5e1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.btn-remove:hover {
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
}

.sale-cart .total-row td {
    padding: 14px;
    border-top: 1px solid #e5e7eb;
    font-weight: 700;
}
.sale-cart .total-label {
    text-align: right;
    font-size: 0.9rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sale-cart .total-value {
    text-align: right;
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
}

.sale-cart .empty-cart {
    text-align: center;
    padding: 3rem 1rem;
}
.empty-cart-content i {
    font-size: 3rem;
    color: #e2e8f0;
    display: block;
    margin-bottom: 0.75rem;
}
.empty-cart-content p {
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.25rem;
    font-size: 1rem;
}
.empty-cart-content span {
    color: #94a3b8;
    font-size: 0.85rem;
}

.sale-sidebar .sidebar-card {
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    padding: 1.5rem;
}
.sidebar-title {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-field {
    margin-bottom: 1rem;
}
.sidebar-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.sidebar-field input[type="date"],
.sidebar-field input[type="text"],
.sidebar-field input[type="number"] {
    width: 100%;
    padding: 0.65rem 0.85rem;
    font-size: 13px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    transition: all 0.15s ease;
    outline: none;
    font-family: inherit;
    color: #374151;
    box-sizing: border-box;
}
.sidebar-field input:focus {
    border-color: #2563eb;
    background: #fff;
}
.sidebar-field input[readonly] {
    background: #fff;
    color: #6b7280;
    cursor: default;
}

.sidebar-select {
    position: relative;
}
.sidebar-select select {
    width: 100%;
    padding: 0.65rem 2.5rem 0.65rem 0.85rem;
    font-size: 13px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    appearance: none;
    cursor: pointer;
    transition: all 0.15s ease;
    outline: none;
    font-family: inherit;
    color: #374151;
    box-sizing: border-box;
}
.sidebar-select select:focus {
    border-color: #2563eb;
}
.sidebar-select .select-arrow {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    font-size: 0.75rem;
}

.sidebar-input-group {
    position: relative;
    display: flex;
    align-items: center;
}
.sidebar-input-group .input-prefix {
    position: absolute;
    left: 0.85rem;
    color: #64748b;
    font-weight: 600;
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 1;
}
.sidebar-input-group input {
    padding-left: 2rem !important;
}

.client-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.client-display input {
    flex: 1;
    padding: 0.65rem 0.85rem;
    font-size: 13px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    outline: none;
    font-family: inherit;
    color: #374151;
    box-sizing: border-box;
}
.client-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: all 0.15s ease;
    flex-shrink: 0;
}
.client-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
}
.client-btn.client-remove:hover {
    border-color: #dc2626 !important;
    color: #dc2626 !important;
    background: #fef2f2 !important;
}

.sidebar-total {
    padding: 1rem;
    margin-top: 1rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    text-align: center;
}
.sidebar-total span {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #9ca3af;
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.sidebar-total strong {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
}

.sidebar-submit {
    width: 100%;
    padding: 0.8rem;
    margin-top: 1rem;
    background: #111827;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
}
.sidebar-submit:hover {
    background: #374151;
}
.sidebar-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sidebar-warning {
    padding: 0.75rem;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 10px;
    font-size: 0.8rem;
    color: #92400e;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.sidebar-warning i {
    color: #f59e0b;
    font-size: 1rem;
}

.sidebar-info {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.75rem;
    text-align: center;
}

/* ---- Modals ---- */
.modal-card {
    border-radius: 16px !important;
    overflow: hidden;
}
.modal-card-head {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
    padding: 1.25rem 1.5rem;
}
.modal-card-title {
    font-weight: 700 !important;
    color: #0a1628 !important;
    font-size: 1.1rem !important;
}
.modal-card-body {
    padding: 1.5rem;
}
.modal-card-body .label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.4rem;
}
.modal-card-body .input {
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.65rem 0.85rem;
    font-family: inherit;
    transition: all 0.2s ease;
    box-sizing: border-box;
}
.modal-card-body .input:focus {
    border-color: #0066ff;
    box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.1);
}

/* ---- Sale Success Card ---- */
.sale-success-card {
    background: #ffffff;
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    border: 1px solid #e5e7eb;
    margin-bottom: 1.5rem;
}
.sale-success-icon {
    font-size: 3rem;
    color: #10b981;
    margin-bottom: 0.75rem;
}
.sale-success-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0a1628;
    margin: 0 0 0.5rem;
}
.sale-success-text {
    font-size: 0.95rem;
    color: #64748b;
    margin: 0 0 1.5rem;
}
.sale-success-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}
.sale-success-actions .btn {
    min-width: 180px;
    justify-content: center;
}

/* ---- Sale Toast ---- */
.sale-toast {
    padding: 0.85rem 1.25rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid transparent;
}
.sale-toast-success {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
    color: #065f46;
}
.sale-toast-success i {
    color: #10b981;
    font-size: 1.1rem;
}

/* ---- Sale Details (from old sales.css) ---- */
.sale-details {
    display: flex;
    justify-content: space-between;
    transition: all .3s ease-in-out;
    padding: 5px;
}
.sale-details:hover {
    background-color: rgba(0, 0, 0, 0.07);
}
.afip-copy {
    background: linear-gradient(90deg,#27ae60 0%, #2ecc71 100%);
    color: #fff !important;
    border: none !important;
    box-shadow: 0 2px 8px rgba(39,174,96,0.18);
}
.afip-copy:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(39,174,96,0.2);
}
.afip-copy.is-small { padding-left:0.6rem; padding-right:0.6rem; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .sale-layout {
        grid-template-columns: 1fr;
    }
    .sale-sidebar {
        order: -1;
    }
    .sale-list-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 768px) {
    .sale-list-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .sale-list-header {
        flex-direction: column;
        align-items: stretch;
    }
    .sale-list-header .sale-search-form {
        max-width: 100%;
    }
    .sale-cart .col-price,
    .sale-cart .col-subtotal {
        display: none;
    }
    .sale-list-footer {
        flex-direction: column;
        text-align: center;
    }
    .sale-cart table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .sale-list-card table.table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
@media (max-width: 480px) {
    .sale-list-stats {
        grid-template-columns: 1fr;
    }
}
