/* ===========================
   ADMIN PANEL - STYLESHEET
   =========================== */

:root {
    /* Cores da Bandeira do Brasil */
    --verde-brasil: #009c3b;
    --amarelo-brasil: #ffdf00;
    --azul-brasil: #002776;
    --branco: #ffffff;
    
    /* Variações de cores */
    --verde-escuro: #007a2e;
    --verde-claro: #00b347;
    --amarelo-escuro: #ffc700;
    --azul-escuro: #001a52;
    --azul-claro: #003399;
    
    /* Cores adicionais */
    --cinza-claro: #f5f5f5;
    --cinza-medio: #e0e0e0;
    --cinza-escuro: #666666;
    --texto-escuro: #333333;
    --vermelho: #e74c3c;
    --verde-sucesso: #27ae60;
    
    /* Sombras */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
    
    /* Bordas */
    --border-radius: 12px;
    --border-radius-sm: 8px;
}

/* ===========================
   RESET E BASE
   =========================== */

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--cinza-claro);
    color: var(--texto-escuro);
    line-height: 1.6;
}

/* ===========================
   LOGIN SCREEN
   =========================== */

.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--verde-brasil) 0%, var(--verde-escuro) 50%, var(--azul-brasil) 100%);
    padding: 20px;
}

.login-container {
    background-color: var(--branco);
    border-radius: var(--border-radius);
    padding: 3rem;
    box-shadow: var(--shadow-lg);
    max-width: 450px;
    width: 100%;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header i {
    font-size: 4rem;
    color: var(--verde-brasil);
    margin-bottom: 1rem;
}

.login-header h1 {
    font-size: 2rem;
    color: var(--verde-brasil);
    margin-bottom: 0.5rem;
}

.login-header h2 {
    font-size: 1.2rem;
    color: var(--azul-brasil);
    font-weight: 600;
}

.login-form {
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.5rem;
    color: var(--texto-escuro);
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--cinza-medio);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--verde-brasil);
    box-shadow: 0 0 0 3px rgba(0, 156, 59, 0.1);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--verde-brasil) 0%, var(--verde-claro) 100%);
    color: var(--branco);
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.error-message {
    background-color: #fee;
    color: var(--vermelho);
    padding: 12px;
    border-radius: var(--border-radius-sm);
    margin-top: 1rem;
    font-weight: 500;
    border-left: 4px solid var(--vermelho);
}

.login-footer {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid var(--cinza-medio);
}

.login-footer a {
    color: var(--azul-brasil);
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s ease;
}

.login-footer a:hover {
    color: var(--verde-brasil);
}

.demo-credentials {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: var(--amarelo-brasil);
    border-radius: var(--border-radius-sm);
    text-align: center;
}

.demo-credentials p {
    margin: 0.3rem 0;
    font-size: 0.9rem;
    color: var(--azul-brasil);
}

.demo-credentials code {
    background-color: var(--branco);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

/* ===========================
   ADMIN DASHBOARD
   =========================== */

.admin-dashboard {
    display: grid;
    grid-template-areas:
        "header header"
        "sidebar content";
    grid-template-columns: 250px 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
}

.admin-header {
    grid-area: header;
    background: linear-gradient(135deg, var(--verde-brasil) 0%, var(--verde-escuro) 100%);
    color: var(--branco);
    padding: 1rem 2rem;
    box-shadow: var(--shadow-md);
}

.admin-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo i {
    font-size: 1.8rem;
    color: var(--amarelo-brasil);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.admin-user span {
    font-weight: 600;
}

.btn-logout {
    padding: 8px 16px;
    background-color: var(--azul-brasil);
    color: var(--branco);
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-logout:hover {
    background-color: var(--azul-claro);
    transform: translateY(-2px);
}

/* ===========================
   SIDEBAR
   =========================== */

.sidebar {
    grid-area: sidebar;
    background-color: var(--branco);
    box-shadow: var(--shadow-sm);
    padding: 2rem 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem 2rem;
    color: var(--texto-escuro);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.nav-item:hover {
    background-color: var(--cinza-claro);
    border-left-color: var(--verde-brasil);
}

.nav-item.active {
    background-color: var(--cinza-claro);
    border-left-color: var(--verde-brasil);
    color: var(--verde-brasil);
}

.nav-item i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

/* ===========================
   MAIN CONTENT
   =========================== */

.admin-content {
    grid-area: content;
    padding: 2rem;
    overflow-y: auto;
}

.content-section {
    display: none;
}

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

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

.section-header h2 {
    font-size: 1.8rem;
    color: var(--verde-brasil);
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-primary {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--verde-brasil) 0%, var(--verde-claro) 100%);
    color: var(--branco);
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.btn-secondary {
    padding: 12px 24px;
    background-color: var(--cinza-medio);
    color: var(--texto-escuro);
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background-color: var(--cinza-escuro);
    color: var(--branco);
}

/* ===========================
   SEARCH AND FILTER BAR
   =========================== */

.search-filter-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 300px;
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: var(--branco);
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    border: 2px solid var(--cinza-medio);
    transition: all 0.3s ease;
}

.search-box:focus-within {
    border-color: var(--verde-brasil);
}

.search-box i {
    color: var(--verde-brasil);
}

.search-box input {
    flex: 1;
    border: none;
    background: none;
    font-size: 1rem;
    outline: none;
}

.filter-select {
    padding: 12px 16px;
    border: 2px solid var(--cinza-medio);
    border-radius: var(--border-radius-sm);
    background-color: var(--branco);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-select:focus {
    outline: none;
    border-color: var(--verde-brasil);
}

/* ===========================
   PRODUCTS TABLE
   =========================== */

.products-table-container {
    background-color: var(--branco);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

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

.products-table thead {
    background-color: var(--verde-brasil);
    color: var(--branco);
}

.products-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.products-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--cinza-medio);
}

.products-table tbody tr:hover {
    background-color: var(--cinza-claro);
}

.product-img-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--border-radius-sm);
}

.platform-badge {
    display: inline-block;
    padding: 4px 10px;
    background-color: var(--azul-brasil);
    color: var(--branco);
    border-radius: var(--border-radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
}

.price-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.price-original {
    text-decoration: line-through;
    color: var(--cinza-escuro);
    font-size: 0.85rem;
}

.price-discount {
    font-weight: 700;
    color: var(--verde-brasil);
    font-size: 1.1rem;
}

.discount-badge {
    display: inline-block;
    padding: 4px 10px;
    background-color: var(--vermelho);
    color: var(--branco);
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
}

.coupon-code {
    background-color: var(--amarelo-brasil);
    padding: 4px 10px;
    border-radius: var(--border-radius-sm);
    font-weight: 700;
    color: var(--azul-brasil);
    display: inline-block;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
}

.status-badge.ativo {
    background-color: #d4edda;
    color: var(--verde-sucesso);
}

.status-badge.inativo {
    background-color: #f8d7da;
    color: var(--vermelho);
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-edit {
    background-color: var(--azul-brasil);
    color: var(--branco);
}

.btn-edit:hover {
    background-color: var(--azul-claro);
}

.btn-delete {
    background-color: var(--vermelho);
    color: var(--branco);
}

.btn-delete:hover {
    background-color: #c0392b;
}

.admin-loading {
    text-align: center;
    padding: 3rem;
    color: var(--cinza-escuro);
}

.admin-loading i {
    font-size: 3rem;
    color: var(--verde-brasil);
    margin-bottom: 1rem;
}

/* ===========================
   STATISTICS
   =========================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background-color: var(--branco);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--branco);
    font-size: 1.5rem;
}

.stat-info h3 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--verde-brasil);
    margin-bottom: 0.3rem;
}

.stat-info p {
    color: var(--cinza-escuro);
    font-size: 0.9rem;
}

.stats-chart {
    background-color: var(--branco);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

.stats-chart h3 {
    color: var(--verde-brasil);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

/* ===========================
   MODAL
   =========================== */

.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background-color: var(--branco);
    border-radius: var(--border-radius);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 2px solid var(--cinza-medio);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--verde-brasil) 0%, var(--verde-claro) 100%);
    color: var(--branco);
}

.modal-header h3 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--branco);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    transition: transform 0.3s ease;
}

.modal-close:hover {
    transform: rotate(90deg);
}

.modal-form {
    padding: 2rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-row.checkboxes {
    display: flex;
    gap: 2rem;
}

.modal-form .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--texto-escuro);
    font-weight: 600;
}

.modal-form input,
.modal-form select,
.modal-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--cinza-medio);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.modal-form input:focus,
.modal-form select:focus,
.modal-form textarea:focus {
    outline: none;
    border-color: var(--verde-brasil);
    box-shadow: 0 0 0 3px rgba(0, 156, 59, 0.1);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

.checkbox-group label {
    font-weight: 600;
    cursor: pointer;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 2px solid var(--cinza-medio);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* ===========================
   RESPONSIVE
   =========================== */

@media (max-width: 1024px) {
    .admin-dashboard {
        grid-template-areas:
            "header"
            "sidebar"
            "content";
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
    }
    
    .sidebar {
        padding: 1rem 0;
    }
    
    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
    }
    
    .nav-item {
        border-left: none;
        border-bottom: 4px solid transparent;
        padding: 1rem;
        white-space: nowrap;
    }
    
    .nav-item:hover,
    .nav-item.active {
        border-left: none;
        border-bottom-color: var(--verde-brasil);
    }
}

@media (max-width: 768px) {
    .admin-header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .search-filter-bar {
        flex-direction: column;
    }
    
    .search-box {
        min-width: 100%;
    }
    
    .products-table-container {
        overflow-x: auto;
    }
    
    .products-table {
        min-width: 800px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}
