/* ============================================
   SISTEMA DE VENDAS - DEPÓSITO DE MATERIAIS
   Estilos Customizados
   ============================================ */

:root {
    --primary: #1a237e;
    --primary-light: #534bae;
    --primary-dark: #000051;
    --secondary: #ff6f00;
    --secondary-light: #ffa040;
    --secondary-dark: #c43e00;
    --success: #2e7d32;
    --danger: #c62828;
    --warning: #f9a825;
    --info: #0277bd;
    --bg-light: #f5f5f5;
    --sidebar-width: 250px;
    --sidebar-collapsed: 0px;
}

/* ============================================
   LAYOUT GERAL
   ============================================ */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-light);
    overflow-x: hidden;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: #fff;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px 15px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.sidebar-header small {
    opacity: 0.7;
    font-size: 0.8rem;
}

.sidebar .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    text-decoration: none;
    font-size: 0.95rem;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
    border-left-color: var(--secondary);
}

.sidebar .nav-link i {
    width: 22px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar .nav-link .badge {
    margin-left: auto;
}

.sidebar .nav-section {
    padding: 15px 20px 5px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.5;
}

/* ============================================
   CONTEÚDO PRINCIPAL
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.top-bar {
    background: #fff;
    padding: 12px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 999;
}

.top-bar .page-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
    margin: 0;
}

.top-bar .user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.9rem;
}

.top-bar .user-info .user-name {
    color: #333;
}

.content-wrapper {
    padding: 20px 25px;
}

/* ============================================
   BOTÃO TOGGLE SIDEBAR (MOBILE)
   ============================================ */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #eee;
    padding: 15px 20px;
    font-weight: 600;
    border-radius: 10px 10px 0 0 !important;
}

.card-body {
    padding: 20px;
}

/* ============================================
   TABELAS
   ============================================ */
.table-container {
    overflow-x: auto;
}

.table {
    margin-bottom: 0;
    font-size: 0.9rem;
}

.table th {
    background: var(--primary);
    color: #fff;
    font-weight: 500;
    white-space: nowrap;
    padding: 10px 12px;
    border: none;
}

.table td {
    padding: 10px 12px;
    vertical-align: middle;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(26, 35, 126, 0.03);
}

.table-hover tbody tr:hover {
    background-color: rgba(255, 111, 0, 0.05);
}

/* ============================================
   FORMULÁRIOS
   ============================================ */
.form-label {
    font-weight: 500;
    font-size: 0.9rem;
    color: #444;
    margin-bottom: 5px;
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1.5px solid #ddd;
    padding: 10px 12px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 0.2rem rgba(26, 35, 126, 0.15);
}

.form-control-lg {
    padding: 12px 16px;
    font-size: 1.1rem;
}

/* ============================================
   BOTÕES
   ============================================ */
.btn {
    border-radius: 8px;
    padding: 8px 20px;
    font-weight: 500;
    transition: all 0.2s;
}

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

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

.btn-secondary {
    background: var(--secondary);
    border-color: var(--secondary);
    color: #fff;
}

.btn-secondary:hover {
    background: var(--secondary-light);
    border-color: var(--secondary-light);
    color: #fff;
}

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

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

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 12px 30px;
    font-size: 1.1rem;
}

/* ============================================
   PDV - TELA DE VENDAS
   ============================================ */
.pdv-container {
    display: flex;
    gap: 20px;
    height: calc(100vh - 140px);
}

.pdv-left {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pdv-right {
    width: 400px;
    display: flex;
    flex-direction: column;
}

.pdv-search {
    position: relative;
    margin-bottom: 15px;
}

.pdv-search input {
    padding: 15px 20px;
    padding-left: 50px;
    font-size: 1.1rem;
    border-radius: 12px;
    border: 2px solid #ddd;
    width: 100%;
}

.pdv-search i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.3rem;
    color: #999;
}

.pdv-products {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    padding: 5px;
}

.pdv-product-card {
    background: #fff;
    border: 2px solid #eee;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.pdv-product-card:hover {
    border-color: var(--secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.pdv-product-card .product-name {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 5px;
    color: #333;
}

.pdv-product-card .product-price {
    color: var(--secondary);
    font-weight: 700;
    font-size: 1rem;
}

.pdv-product-card .product-stock {
    font-size: 0.75rem;
    color: #999;
}

.pdv-cart {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pdv-cart-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
}

.pdv-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.pdv-cart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
}

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

.pdv-cart-item .item-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.pdv-cart-item .item-details {
    font-size: 0.8rem;
    color: #666;
}

.pdv-cart-item .item-total {
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.pdv-cart-item .btn-remove {
    color: var(--danger);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 5px;
}

.pdv-cart-footer {
    padding: 15px;
    border-top: 2px solid #eee;
}

.pdv-total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.pdv-total-row.total {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    border-top: 2px solid var(--primary);
    padding-top: 8px;
}

/* ============================================
   LOGIN
   ============================================ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card .login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-card .login-logo h2 {
    color: var(--primary);
    font-weight: 700;
}

.login-card .login-logo p {
    color: #666;
    font-size: 0.9rem;
}

/* ============================================
   DASHBOARD
   ============================================ */
.dashboard-card {
    border-radius: 12px;
    padding: 20px;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.dashboard-card .card-icon {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 3rem;
    opacity: 0.2;
}

.dashboard-card .card-value {
    font-size: 2rem;
    font-weight: 700;
}

.dashboard-card .card-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.bg-primary-gradient {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.bg-secondary-gradient {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-light) 100%);
}

.bg-success-gradient {
    background: linear-gradient(135deg, var(--success) 0%, #4caf50 100%);
}

.bg-info-gradient {
    background: linear-gradient(135deg, var(--info) 0%, #29b6f6 100%);
}

/* ============================================
   FLASH MESSAGE
   ============================================ */
.alert {
    border-radius: 10px;
    border: none;
}

/* ============================================
   RESPONSIVIDADE
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    .content-wrapper {
        padding: 15px;
    }

    .top-bar {
        padding: 10px 15px;
    }

    .top-bar .page-title {
        font-size: 1rem;
    }

    .top-bar .user-info .user-name {
        display: none;
    }

    /* PDV responsivo */
    .pdv-container {
        flex-direction: column;
        height: auto;
    }

    .pdv-right {
        width: 100%;
    }

    .pdv-products {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    /* Cards dashboard */
    .dashboard-card .card-value {
        font-size: 1.5rem;
    }

    /* Login */
    .login-card {
        margin: 20px;
        padding: 25px;
    }

    /* Tabelas */
    .table-responsive-cards .table thead {
        display: none;
    }

    .table-responsive-cards .table tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 8px;
        background: #fff;
    }

    .table-responsive-cards .table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 15px;
        border-bottom: 1px solid #f0f0f0;
    }

    .table-responsive-cards .table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #666;
        font-size: 0.8rem;
        margin-right: 10px;
    }

    .table-responsive-cards .table td:last-child {
        border-bottom: none;
    }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ============================================
   IMPRESSÃO
   ============================================ */
@media print {
    .sidebar, .top-bar, .sidebar-toggle, .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .content-wrapper {
        padding: 0 !important;
    }
}

/* ============================================
   UTILITÁRIOS
   ============================================ */
.text-primary-custom { color: var(--primary); }
.text-secondary-custom { color: var(--secondary); }
.bg-primary-custom { background-color: var(--primary); }
.bg-secondary-custom { background-color: var(--secondary); }

.cursor-pointer { cursor: pointer; }

.no-wrap { white-space: nowrap; }

/* Loading spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
