/**
 * Realtur - Sistema de Controle de Estoque
 * Estilos Principais
 * Cores: Branco, Marrom (#8B4513), Amarelo (#D4A017), Cinza
 */

/* ==================== VARIÁVEIS ==================== */
:root {
    --color-primary: #8B4513;
    --color-primary-dark: #6B3410;
    --color-primary-light: #A0522D;
    --color-secondary: #D4A017;
    --color-secondary-light: #E5B52A;
    --color-accent: #F5F5DC;
    --color-dark: #333333;
    --color-gray: #666666;
    --color-gray-light: #999999;
    --color-light: #F8F9FA;
    --color-white: #FFFFFF;
    --color-danger: #DC3545;
    --color-success: #28A745;
    --color-warning: #FFC107;
    --color-info: #17A2B8;
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.2);
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    --transition: all 0.3s ease;
    --sidebar-width: 280px;
}

/* ==================== RESET E BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--color-light);
    color: var(--color-dark);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    outline: none;
    font-family: inherit;
}

input, select, textarea {
    font-family: inherit;
    outline: none;
}

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

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-box {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

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

.login-logo img {
    max-width: 180px;
    height: auto;
    margin-bottom: 15px;
}

.login-logo h1 {
    color: var(--color-primary);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.login-logo p {
    color: var(--color-gray);
    font-size: 0.95rem;
}

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

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

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--color-secondary);
}

.form-control::placeholder {
    color: var(--color-gray-light);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    transition: var(--transition);
}

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

.btn-primary:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

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

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

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

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

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

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

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.125rem;
}

/* ==================== LAYOUT PRINCIPAL ==================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-primary);
    color: var(--color-white);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

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

.sidebar-logo {
    max-width: 150px;
    height: auto;
    margin-bottom: 10px;
}

.sidebar-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-white);
}

.sidebar-header p {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.7);
    margin-top: 5px;
}

.sidebar-menu {
    padding: 15px 0;
    flex: 1;
    overflow-y: auto;
}

.menu-category {
    padding: 15px 20px 5px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.5);
    font-weight: 600;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.9);
    transition: var(--transition);
    border-left: 4px solid transparent;
}

.menu-item:hover {
    background: rgba(255,255,255,0.1);
    color: var(--color-white);
}

.menu-item.active {
    background: rgba(255,255,255,0.15);
    border-left-color: var(--color-secondary);
    color: var(--color-white);
}

.menu-item i, .menu-item span:first-child {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--color-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 500;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.6);
    text-transform: capitalize;
}

.logout-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s;
}

.logout-btn:hover {
    color: var(--color-white);
}

/* Menu Toggle para Mobile */
.menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--color-primary);
    color: var(--color-white);
    width: 45px;
    height: 45px;
    border-radius: var(--radius-md);
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: var(--shadow-md);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* ==================== CONTEÚDO PRINCIPAL ==================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 25px;
    min-height: 100vh;
    transition: var(--transition);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 15px;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--color-dark);
}

.page-title span {
    color: var(--color-primary);
}

.page-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ==================== CARDS ==================== */
.card {
    background: var(--color-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 18px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-dark);
}

.card-body {
    padding: 20px;
}

/* ==================== STATS CARDS ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--color-white);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-icon.primary {
    background: rgba(139, 69, 19, 0.1);
    color: var(--color-primary);
}

.stat-icon.secondary {
    background: rgba(212, 160, 23, 0.1);
    color: var(--color-secondary);
}

.stat-icon.success {
    background: rgba(40, 167, 69, 0.1);
    color: var(--color-success);
}

.stat-icon.danger {
    background: rgba(220, 53, 69, 0.1);
    color: var(--color-danger);
}

.stat-info h3 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--color-dark);
    line-height: 1;
}

.stat-info p {
    color: var(--color-gray);
    font-size: 0.85rem;
    margin-top: 4px;
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    font-weight: 600;
    color: var(--color-dark);
    background: #f8f9fa;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

.data-table td {
    font-size: 0.9rem;
}

/* ==================== BADGES ==================== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: rgba(40, 167, 69, 0.1);
    color: var(--color-success);
}

.badge-danger {
    background: rgba(220, 53, 69, 0.1);
    color: var(--color-danger);
}

.badge-warning {
    background: rgba(255, 193, 7, 0.1);
    color: #856404;
}

.badge-info {
    background: rgba(23, 162, 184, 0.1);
    color: var(--color-info);
}

.badge-primary {
    background: rgba(139, 69, 19, 0.1);
    color: var(--color-primary);
}

/* ==================== ALERTAS ==================== */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: rgba(40, 167, 69, 0.1);
    color: var(--color-success);
    border-left: 4px solid var(--color-success);
}

.alert-danger {
    background: rgba(220, 53, 69, 0.1);
    color: var(--color-danger);
    border-left: 4px solid var(--color-danger);
}

.alert-warning {
    background: rgba(255, 193, 7, 0.1);
    color: #856404;
    border-left: 4px solid var(--color-warning);
}

/* ==================== MODAL ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 18px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--color-white);
    z-index: 10;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-gray);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--color-dark);
    background: #f0f0f0;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 18px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    position: sticky;
    bottom: 0;
    background: var(--color-white);
    z-index: 10;
}

/* ==================== FILTROS ==================== */
.filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: end;
}

.filter-group {
    flex: 1;
    min-width: 160px;
}

.filter-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.8rem;
    color: var(--color-gray);
}

/* ==================== PAGINAÇÃO ==================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.page-btn {
    padding: 8px 14px;
    border: 1px solid #ddd;
    background: var(--color-white);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

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

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

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

/* ==================== GRID ==================== */
.grid {
    display: grid;
    gap: 15px;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* ==================== TABS ==================== */
.tabs {
    display: flex;
    gap: 5px;
    border-bottom: 2px solid #eee;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    font-size: 0.9rem;
}

.tab:hover {
    color: var(--color-primary);
}

.tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 500;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ==================== LOADING ==================== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #eee;
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==================== ESTOQUE BAIXO ALERTA ==================== */
.estoque-baixo-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    border-left: 4px solid var(--color-danger);
    background: rgba(220, 53, 69, 0.05);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
}

.estoque-baixo-info h4 {
    font-size: 0.95rem;
    color: var(--color-dark);
    margin-bottom: 3px;
}

.estoque-baixo-info p {
    font-size: 0.8rem;
    color: var(--color-gray);
}

.estoque-baixo-qtd {
    text-align: right;
}

.estoque-baixo-qtd .atual {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-danger);
}

.estoque-baixo-qtd .minimo {
    font-size: 0.75rem;
    color: var(--color-gray);
}

/* ==================== RESPONSIVO ==================== */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 260px;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }
    
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 70px 15px 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
        min-width: auto;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .page-title {
        font-size: 1.3rem;
    }
    
    .data-table {
        font-size: 0.85rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 12px;
    }
    
    .modal {
        max-height: 95vh;
        margin: 10px;
    }
    
    .modal-footer {
        flex-direction: column-reverse;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .login-box {
        padding: 25px;
    }
    
    .login-logo h1 {
        font-size: 1.6rem;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
    }
    
    .stat-icon {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
    
    .stat-info h3 {
        font-size: 1.4rem;
    }
}

/* ==================== UTILITÁRIOS ==================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.hidden { display: none !important; }

/* ==================== GRÁFICOS ==================== */
.chart-container {
    position: relative;
    height: 280px;
    margin: 15px 0;
}

/* ==================== PRINT ==================== */
@media print {
    .sidebar,
    .menu-toggle,
    .page-actions,
    .btn {
        display: none !important;
    }
    .main-content {
        margin-left: 0;
        padding: 0;
    }
}
