/* Variáveis do Painel Admin */
:root {
    --admin-bg: #fdfaf6;
    --admin-sidebar-bg: #2c1e16;
    --admin-sidebar-hover: #4a3325;
    --admin-text-main: #333333;
    --admin-text-light: #7b6a60;
    --brand-red: #8B4513;
    --brand-red-dark: #5D2906;
    --card-bg: #ffffff;
    --success: #10b981;
    --warning: #f59e0b;
    --border-color: #e5d9d1;
    --border-radius: 12px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* Reset / Globals */
html,
body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--admin-bg);
    color: var(--admin-text-main);
    box-sizing: border-box;
}

*,
*:before,
*:after {
    box-sizing: inherit;
}

button {
    font-family: inherit;
    cursor: pointer;
}

/* Loader Inicial */
.admin-auth-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s;
}

.admin-auth-loader i {
    font-size: 3rem;
    color: var(--brand-red);
    margin-bottom: 15px;
}

/* Layout Principal */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 250px;
    background: var(--admin-sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    transition: width 0.3s;
    position: sticky;
    top: 0;
    height: 100vh;
}

.admin-brand {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-brand h2 {
    margin: 0;
    font-family: 'Oswald', sans-serif;
    font-size: 1.8rem;
    letter-spacing: 1px;
}

.admin-brand h2 span {
    color: var(--brand-red);
}

.admin-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    margin-top: 5px;
    display: inline-block;
}

.admin-nav {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
}

.admin-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.admin-nav li {
    margin-bottom: 5px;
}

.admin-nav a {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    border-right: 3px solid transparent;
}

.admin-nav a i {
    width: 25px;
    font-size: 1.1rem;
    margin-right: 10px;
}

.admin-nav a:hover,
.admin-nav li.active a {
    background: var(--admin-sidebar-hover);
    color: #fff;
    border-right-color: var(--brand-red);
}

.admin-sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.back-to-store,
.admin-logout-btn {
    text-align: center;
    padding: 10px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: 0.2s;
}

.back-to-store {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.back-to-store:hover {
    background: rgba(255, 255, 255, 0.2);
}

.admin-logout-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ef4444;
}

.admin-logout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Main Area */
.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: calc(100% - 250px);
}

/* Header Secundário */
.admin-header {
    background: var(--card-bg);
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-title h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--admin-sidebar-bg);
}

.header-title p {
    margin: 5px 0 0 0;
    color: var(--admin-text-light);
    font-size: 0.9rem;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-greeting {
    font-size: 0.9rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--admin-sidebar-hover);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* Conteúdo */
.admin-content-area {
    padding: 30px 40px;
    flex: 1;
    overflow-y: auto;
}

.admin-section {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.admin-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow);
    margin-bottom: 25px;
}

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

.card-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--admin-sidebar-bg);
}

.admin-split-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 25px;
}

/* Formulários */
.dashboard-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.span-2 {
    grid-column: span 2;
}

.span-full {
    grid-column: 1 / -1;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--admin-sidebar-bg);
    margin-bottom: 8px;
}

.required {
    color: var(--brand-red);
}

.input-icon {
    position: relative;
}

.input-icon i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--admin-text-light);
    font-size: 0.9rem;
}

.input-icon input {
    padding-left: 38px !important;
}

.form-group input[type="text"],
.form-group input[type="number"],
.custom-select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--admin-text-main);
    background: #fff;
    transition: all 0.2s;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group input:focus,
.custom-select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px rgba(166, 29, 36, 0.1);
}

.card-highlight {
    background: #f8fafc;
    border: 1px dashed var(--border-color);
    padding: 15px;
    border-radius: 8px;
}

/* Grade de Tamanhos (Admin Size Grid) */
.admin-size-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.size-box {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.size-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: #f1f5f9;
}

.size-box-header strong {
    color: var(--brand-red);
    font-size: 0.95rem;
}

.admin-size-select {
    padding: 4px;
    font-size: 0.75rem;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.size-stock-panel {
    padding: 8px 10px;
    border-top: 1px solid var(--border-color);
}

.admin-size-qty {
    width: 100%;
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.85rem;
}

/* Checkbox Cards Destaques */
.checkbox-group-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.checkbox-card {
    cursor: pointer;
    position: relative;
}

.checkbox-card input {
    position: absolute;
    opacity: 0;
}

.cc-content {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    transition: all 0.2s;
    background: #fff;
    height: 100%;
}

.cc-content i {
    font-size: 1.5rem;
    color: var(--admin-text-light);
    margin-bottom: 10px;
    display: block;
}

.cc-content strong {
    display: block;
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.cc-content span {
    font-size: 0.75rem;
    color: var(--admin-text-light);
}

.checkbox-card input:checked~.cc-content {
    border-color: var(--brand-red);
    background: rgba(166, 29, 36, 0.05);
}

.checkbox-card input:checked~.cc-content i,
.checkbox-card input:checked~.cc-content strong {
    color: var(--brand-red);
}

/* Upload de Arquivos */
.file-upload-wrapper {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    background: #f8fafc;
    transition: 0.2s;
}

.file-upload-wrapper:hover {
    border-color: var(--brand-red);
    background: rgba(166, 29, 36, 0.02);
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-icon i {
    font-size: 2rem;
    color: var(--admin-text-light);
    margin-bottom: 10px;
}

.file-upload-wrapper p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--admin-text-light);
}

/* Imagens Existentes */
.existing-images-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.existing-image-box {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.existing-image-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.existing-image-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: 0.2s;
}

.existing-image-remove:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Botões */
.btn-dashboard-primary {
    background: var(--brand-red);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-dashboard-primary:hover {
    background: var(--brand-red-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(166, 29, 36, 0.2);
}

.btn-dashboard-secondary {
    background: #fff;
    color: var(--admin-text-main);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: 0.2s;
}

.btn-dashboard-secondary:hover {
    background: #f1f5f9;
}

.w-100 {
    width: 100%;
}

/* Tabelas (Manage / Pedidos / Cupons) */
.table-responsive {
    overflow-x: auto;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.dashboard-table th {
    background: #f8fafc;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: var(--admin-text-light);
    border-bottom: 2px solid var(--border-color);
}

.dashboard-table td {
    padding: 15px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

.dashboard-table tr:hover {
    background: #f8fafc;
}

.t-img {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-btn {
    background: none;
    border: none;
    padding: 6px;
    border-radius: 4px;
    color: var(--admin-text-light);
    transition: 0.2s;
    font-size: 1.1rem;
}

.action-btn.edit:hover {
    background: #e0f2fe;
    color: #0284c7;
}

.action-btn.delete:hover {
    background: #fee2e2;
    color: #ef4444;
}

.action-btn.reviews {
    color: var(--warning);
}

.action-btn.reviews:hover {
    background: #fef3c7;
}

/* Status Badges */
.badge {
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.badge.Aguardando {
    background: #fef3c7;
    color: #d97706;
}

.badge.Pago {
    background: #dcfce3;
    color: #15803d;
}

.badge.Enviado {
    background: #e0f2fe;
    color: #0369a1;
}

.badge.Entregue {
    background: #f3f4f6;
    color: #475569;
}

/* Search Box */
.search-box {
    position: relative;
    width: 250px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--admin-text-light);
}

.search-box input {
    width: 100%;
    padding: 8px 12px 8px 32px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    outline: none;
}

.search-box input:focus {
    border-color: var(--brand-red);
}

/* Orders List format (If we don't use table) */
.orders-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.order-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    background: #fff;
    transition: box-shadow 0.2s;
}

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

.oc-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.oc-header h4 {
    margin: 0;
    color: var(--admin-sidebar-bg);
}

.oc-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    font-size: 0.9rem;
}

.oc-items {
    background: #f8fafc;
    padding: 10px;
    border-radius: 6px;
}

.oc-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f1f5f9;
}

/* Modais Nativo (Importado/Adaptado do Store) */
.wl-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.wl-toast {
    background: #2c1e16;
    color: #fff;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border-left: 4px solid var(--brand-red);
    min-width: 250px;
    max-width: 350px;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: flex-start;
    gap: 15px;
    pointer-events: auto;
}

.wl-toast.show {
    transform: translateX(0);
}

.wl-toast-msg {
    font-size: 0.95rem;
    line-height: 1.4;
    flex: 1;
    word-wrap: break-word;
}

.wl-toast-close {
    cursor: pointer;
    color: #aaa;
    background: none;
    border: none;
    font-size: 1.2rem;
    transition: color 0.2s;
    padding: 0;
    display: flex;
    align-items: center;
}

.wl-toast-close:hover {
    color: #fff;
}

.wl-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    backdrop-filter: blur(3px);
}

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

.wl-modal {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s;
    text-align: center;
}

.wl-modal-overlay.show .wl-modal {
    transform: translateY(0) scale(1);
}

.wl-modal-title {
    font-size: 1.3rem;
    color: var(--admin-sidebar-bg);
    margin-bottom: 15px;
    font-weight: 700;
    font-family: 'Oswald', sans-serif;
}

.wl-modal-msg {
    font-size: 1rem;
    color: #555;
    margin-bottom: 25px;
    line-height: 1.5;
}

.wl-modal-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    margin-bottom: 20px;
    box-sizing: border-box;
    outline: none;
}

.wl-modal-input:focus {
    border-color: var(--brand-red);
}

.wl-modal-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* Modal Interno Full-Screen (Reviews) */
.admin-review-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 5000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.admin-review-modal {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    width: 600px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow);
}

.admin-review-modal .close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #888;
}

@media (max-width: 768px) {
    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: row;
        align-items: center;
        padding: 10px;
        overflow-x: auto;
    }

    .admin-brand {
        border-bottom: none;
        border-right: 1px solid rgba(255, 255, 255, 0.1);
        padding: 0 15px;
    }

    .admin-brand h2 {
        font-size: 1.2rem;
    }

    .admin-nav {
        display: flex;
        white-space: nowrap;
        padding: 0 10px;
    }

    .admin-nav ul {
        display: flex;
        margin: 0;
    }

    .admin-sidebar-footer {
        flex-direction: row;
        border-top: none;
        padding: 0 10px;
    }

    .admin-main {
        max-width: 100%;
    }

    .admin-split-layout {
        grid-template-columns: 1fr;
    }

    .checkbox-group-cards {
        grid-template-columns: 1fr;
    }

    .oc-body {
        grid-template-columns: 1fr;
    }
}