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

:root {
    --primary: #E11D48;
    --primary-dark: #BE123C;
    --secondary: #EC4899;
    --success: #22C55E;
    --warning: #F59E0B;
    --danger: #EF4444;
    --bg-dark: #0F172A;
    --bg-card: #1E293B;
    --bg-card-alt: #334155;
    --text: #F8FAFC;
    --text-muted: #94A3B8;
    --border: #475569;
    --gradient: linear-gradient(135deg, #E11D48 0%, #EC4899 100%);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text);
    line-height: 1.6;
}

.app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-card);
    padding: 20px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    margin-bottom: 30px;
}

.logo-icon {
    font-size: 2rem;
}

.logo h1 {
    font-size: 1.3rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.nav-item:hover {
    background: var(--bg-card-alt);
    color: var(--text);
}

.nav-item.active {
    background: var(--gradient);
    color: white;
}

.nav-icon {
    font-size: 1.2rem;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    margin-bottom: 15px;
    background: var(--danger);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: #DC2626;
    transform: translateY(-2px);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.section-header h2 {
    font-size: 1.8rem;
}

.section-header p {
    color: var(--text-muted);
    margin-top: 5px;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Buttons */
.btn-primary {
    background: var(--gradient);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(225, 29, 72, 0.4);
}

.btn-secondary {
    background: var(--bg-card-alt);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.btn-success {
    background: var(--success);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-success:hover {
    opacity: 0.9;
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background: #DC2626;
}

.btn-clear {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 0.9rem;
}

/* Sales Section */
.sales-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
}

.products-panel {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
}

.search-box {
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 14px 20px;
    background: var(--bg-card-alt);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 1rem;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    max-height: calc(100vh - 280px);
    overflow-y: auto;
}

.product-card {
    background: var(--bg-card-alt);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.product-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
}

.product-emoji {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.product-name {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.product-price {
    color: var(--success);
    font-weight: 700;
    font-size: 1.1rem;
}

.product-stock {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 5px;
}

/* Cart Panel */
.cart-panel {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 120px);
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.cart-header h3 {
    font-size: 1.2rem;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 15px 0;
    min-height: 150px;
}

.cart-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 30px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-card-alt);
    border-radius: 8px;
    margin-bottom: 10px;
}

.cart-item-info {
    flex: 1;
}

.cart-item-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.cart-item-price {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    font-size: 1rem;
}

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

.cart-item-qty {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
}

.cart-item-total {
    font-weight: 700;
    color: var(--success);
    min-width: 80px;
    text-align: right;
}

.remove-item {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.2rem;
    margin-left: 10px;
}

/* Cart Summary */
.cart-summary {
    padding: 15px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.summary-row.total {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--success);
}

.discount-input {
    display: flex;
    align-items: center;
    gap: 5px;
}

.discount-input input {
    width: 60px;
    padding: 6px 10px;
    background: var(--bg-card-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    text-align: center;
}

/* Payment Section */
.payment-section {
    padding: 15px 0;
}

.payment-section h4,
.customer-section h4 {
    font-size: 0.95rem;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.payment-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.payment-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: var(--bg-card-alt);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.payment-option:hover {
    background: var(--bg-dark);
}

.payment-option input {
    display: none;
}

.payment-option input:checked + span {
    color: var(--primary);
}

.payment-option input:checked ~ span::before {
    content: '✓ ';
}

/* Installments Section */
.installments-section {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding: 12px;
    background: var(--bg-card-alt);
    border-radius: 8px;
}

.installments-section label {
    font-weight: 500;
    color: var(--text);
}

.installments-section select {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.95rem;
    cursor: pointer;
}

.installments-section select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Customer Section */
.customer-section {
    padding: 15px 0;
}

.customer-section input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-card-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    margin-bottom: 10px;
}

.customer-section input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-checkout {
    width: 100%;
    padding: 16px;
    background: var(--gradient);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
}

.btn-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(225, 29, 72, 0.4);
}

.btn-checkout:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Tables */
.products-table-container,
.sales-history-table {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
}

.products-table,
.history-table {
    width: 100%;
    border-collapse: collapse;
}

.products-table th,
.history-table th {
    background: var(--bg-card-alt);
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
}

.products-table td,
.history-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border);
}

.products-table tr:hover,
.history-table tr:hover {
    background: var(--bg-card-alt);
}

.action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    margin-right: 10px;
    transition: transform 0.2s;
}

.action-btn:hover {
    transform: scale(1.2);
}

/* Stats Cards */
.sales-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    font-size: 2.5rem;
    background: var(--gradient);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
}

.stat-label {
    color: var(--text-muted);
}

.filter-group {
    display: flex;
    gap: 10px;
}

.filter-group input {
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
}

/* Receipts Grid */
.receipts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.receipt-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.receipt-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
}

.receipt-card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.receipt-card-number {
    font-weight: 700;
    color: var(--primary);
}

.receipt-card-date {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.receipt-card-customer {
    margin-bottom: 10px;
}

.receipt-card-total {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--success);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-card-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* Receipt Modal */
.receipt-modal {
    max-width: 400px;
    padding: 0;
    background: white;
    color: #000;
}

.receipt {
    padding: 30px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.receipt-header {
    text-align: center;
    margin-bottom: 15px;
}

.receipt-header h2 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.receipt-header p {
    font-size: 12px;
    color: #666;
}

.receipt-divider {
    text-align: center;
    color: #999;
    margin: 10px 0;
}

.receipt-info {
    text-align: center;
    margin-bottom: 15px;
}

.receipt-info p {
    margin: 3px 0;
}

.receipt-items {
    margin: 15px 0;
}

.receipt-item {
    display: flex;
    justify-content: space-between;
    margin: 5px 0;
    font-size: 13px;
}

.receipt-item-details {
    flex: 1;
}

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

.receipt-totals p {
    margin: 5px 0;
}

.receipt-total {
    font-size: 1.2rem;
    margin-top: 10px;
}

.receipt-payment {
    text-align: center;
    margin: 10px 0;
}

.receipt-footer {
    text-align: center;
    margin-top: 15px;
    font-size: 12px;
}

.receipt-timestamp {
    color: #999;
    font-size: 10px;
    margin-top: 10px;
}

.receipt-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 1200px) {
    .sales-container {
        grid-template-columns: 1fr;
    }
    
    .cart-panel {
        max-height: none;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        z-index: 100;
        transition: left 0.3s ease;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .sales-stats {
        grid-template-columns: 1fr;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media print {
    .receipt-actions {
        display: none;
    }
    
    .receipt-modal {
        box-shadow: none;
    }
}

/* Company Form */
.company-form-container {
    max-width: 500px;
}

.company-form {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.company-form .form-group {
    margin-bottom: 20px;
}

.company-form .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text);
}

.company-form .form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-card-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
}

.company-form .form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.company-form .btn-primary {
    width: 100%;
    margin-top: 10px;
}

/* Empresa Section */
.empresa-ativa-container {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.empresa-ativa-container h3 {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.empresa-select {
    width: 100%;
    max-width: 400px;
    padding: 12px 16px;
    background: var(--bg-card-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
}

.empresa-select:focus {
    outline: none;
    border-color: var(--primary);
}

.empresas-table-container {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

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

.empresas-table th,
.empresas-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.empresas-table th {
    background: var(--bg-card-alt);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.empresas-table tr:hover {
    background: var(--bg-card-alt);
}
