/* ============================================================
   SABORES WOK — BACKOFFICE
   admin.css v1.3
   ============================================================ */

:root {
    --primary: #d32f2f;
    --primary-dark: #b71c1c;
    --primary-light: #ef5350;
    --accent: #ffab00;
    --success: #2e7d32;
    --danger: #c62828;
    --warning: #ef6c00;
    --dark: #1a1a1a;
    --dark-2: #2d2d2d;
    --dark-3: #3a3a3a;
    --light: #f5f5f5;
    --light-2: #e9e9e9;
    --text: #333;
    --text-light: #777;
    --white: #fff;
    --border: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius: 8px;
    --radius-lg: 12px;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--light);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4 { font-weight: 600; color: var(--dark); }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-dark); }

/* ============================================================
   HEADER
   ============================================================ */
.admin-header {
    background: var(--dark);
    color: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 32px;
    height: 64px;
}

.admin-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--white);
    font-weight: 600;
    font-size: 1.05rem;
}

.admin-logo i { color: var(--primary); font-size: 1.3rem; }
.admin-logo small {
    font-size: 0.7rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-left: 4px;
}

.admin-nav {
    flex: 1;
    display: flex;
    gap: 4px;
    overflow-x: auto;
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 6px;
    color: #ccc;
    font-weight: 500;
    font-size: 0.85rem;
    white-space: nowrap;
    transition: all .2s;
}

.admin-nav a:hover { background: var(--dark-2); color: var(--white); }
.admin-nav a.active { background: var(--primary); color: var(--white); }
.admin-nav a i { font-size: 0.95rem; }

.admin-user {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.admin-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
}

.admin-user-nome { font-weight: 600; font-size: 0.85rem; }
.admin-user-nivel {
    font-size: 0.7rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--dark-2);
    color: #ccc;
    transition: all .2s;
}

.admin-logout:hover {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-2px);
}

/* ============================================================
   MAIN
   ============================================================ */
.admin-main {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px;
}

.admin-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.admin-page-header h1 {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-page-header h1 i { color: var(--primary); }

.admin-page-header .admin-page-sub {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-top: 4px;
}

/* ============================================================
   CARDS
   ============================================================ */
.admin-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.admin-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.admin-card-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-card-header h2 i { color: var(--primary); }
.admin-card-header h2 small {
    font-weight: 400;
    color: var(--text-light);
    font-size: 0.85rem;
}

/* Grid de estatísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all .2s;
}

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

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

.stat-icon.primary { background: var(--primary); }
.stat-icon.success { background: var(--success); }
.stat-icon.warning { background: var(--warning); }
.stat-icon.accent  { background: var(--accent); }

.stat-info { display: flex; flex-direction: column; gap: 4px; }
.stat-valor { font-size: 1.75rem; font-weight: 700; color: var(--dark); }
.stat-label { font-size: 0.8rem; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; }

/* ============================================================
   BOTÕES
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    white-space: nowrap;
}

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

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

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

.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #1b5e20; color: var(--white); }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #8b0000; color: var(--white); }

.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--light); color: var(--text); }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ============================================================
   FORMULÁRIOS
   ============================================================ */
.form-group { margin-bottom: 18px; }

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

.form-group label .req { color: var(--primary); }

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text);
    background: var(--white);
    transition: border-color .2s, box-shadow .2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1);
}

.form-control:disabled { background: var(--light); cursor: not-allowed; }

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

.form-help {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-top: 4px;
}

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

/* ============================================================
   TABELAS
   ============================================================ */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th {
    text-align: left;
    padding: 12px 14px;
    background: var(--light);
    color: var(--dark);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

.admin-table td {
    padding: 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.admin-table tr:hover td { background: #fafafa; }
.admin-table tr:last-child td { border-bottom: none; }

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

.badge-success { background: #e8f5e9; color: var(--success); }
.badge-danger  { background: #ffebee; color: var(--danger); }
.badge-warning { background: #fff3e0; color: var(--warning); }
.badge-primary { background: #ffebee; color: var(--primary); }
.badge-neutral { background: var(--light-2); color: var(--text-light); }

/* ============================================================
   MENSAGENS FLASH
   ============================================================ */
.admin-flash {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    margin: 20px auto;
    max-width: 1400px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    animation: flashIn .3s ease;
}

@keyframes flashIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.admin-flash span { flex: 1; font-weight: 500; }
.admin-flash button {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    padding: 0 4px;
    line-height: 1;
}
.admin-flash button:hover { opacity: 1; }

.admin-flash-sucesso { background: #e8f5e9; color: var(--success); border-left: 4px solid var(--success); }
.admin-flash-erro    { background: #ffebee; color: var(--danger);  border-left: 4px solid var(--danger); }
.admin-flash-info    { background: #e3f2fd; color: #0d47a1;         border-left: 4px solid #1976d2; }

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

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 40px;
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 32px;
}

.login-logo i {
    font-size: 2.5rem;
    color: var(--primary);
}

.login-logo h1 {
    font-size: 1.5rem;
    margin: 0;
}

.login-logo p {
    color: var(--text-light);
    font-size: 0.85rem;
    margin: 0;
}

.login-card .btn { margin-top: 8px; }

.login-error {
    background: #ffebee;
    color: var(--danger);
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-info {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-light);
}

/* ============================================================
   FOOTER
   ============================================================ */
.admin-footer {
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 20px 24px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-light);
}

.admin-footer-sep { margin: 0 10px; opacity: 0.4; }

/* ============================================================
   UTILITÁRIOS
   ============================================================ */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-light); }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* ============================================================
   SPINNER
   ============================================================ */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0,0,0,.1);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

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

/* ============================================================
   GESTÃO DE PREÇOS
   ============================================================ */
.precos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.preco-item {
    display: flex;
    flex-direction: column;
}

.preco-item label {
    font-weight: 600;
    font-size: .85rem;
    color: var(--text);
    margin-bottom: 8px;
}

.preco-item label small {
    font-weight: 400;
    color: var(--text-light);
    font-size: .78rem;
}

.preco-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.preco-input {
    padding-right: 36px !important;
    font-size: 1.05rem !important;
    font-weight: 600;
    text-align: right;
    font-family: 'Courier New', monospace;
    letter-spacing: .5px;
    transition: all .2s;
}

.preco-input:focus {
    background: #fffbf0;
}

.preco-input.alterado {
    border-color: var(--accent);
    background: #fffbf0;
    box-shadow: 0 0 0 3px rgba(255, 171, 0, .15);
}

.preco-simbolo {
    position: absolute;
    right: 14px;
    color: var(--text-light);
    font-weight: 600;
    pointer-events: none;
    font-size: .95rem;
}

/* Barra de ações sticky no fundo */
.precos-acoes {
    position: sticky;
    bottom: 20px;
    background: var(--dark);
    color: var(--white);
    padding: 16px 24px;
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 32px;
    z-index: 50;
}

.precos-acoes-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .9rem;
    color: #ddd;
}

.precos-acoes-info.alerta { color: var(--accent); }
.precos-acoes-info i { font-size: 1.1rem; }

.precos-acoes-botoes {
    display: flex;
    gap: 10px;
}

.precos-acoes .btn-ghost {
    background: transparent;
    color: #ccc;
    border: 1px solid #555;
}

.precos-acoes .btn-ghost:hover {
    background: var(--dark-2);
    color: var(--white);
    border-color: #777;
}

/* ============================================================
   GESTÃO DE IMAGENS
   ============================================================ */
.imagens-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

/* Modo compacto: imagem à esquerda, info à direita */
.imagens-grid-single {
    grid-template-columns: 1fr;
}

.imagens-grid-single .imagem-card {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 0;
    max-width: 900px;
}

.imagens-grid-single .imagem-preview {
    aspect-ratio: auto;
    height: 100%;
    min-height: 160px;
}

.imagens-grid-single .imagem-info {
    padding: 20px 24px;
    justify-content: center;
}

/* Card normal (slider, menu) */
.imagem-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all .2s;
}

.imagem-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.imagem-card.uploading {
    border-color: var(--accent);
    background: #fffbf0;
    pointer-events: none;
    opacity: .7;
}

.imagem-card.drag-over {
    border-color: var(--primary);
    border-style: dashed;
    background: #fff5f5;
}

.imagem-preview {
    position: relative;
    aspect-ratio: 16 / 10;
    background: var(--light);
    overflow: hidden;
    cursor: pointer;
}

.imagem-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s;
}

.imagem-card:hover .imagem-thumb {
    transform: scale(1.03);
}

.imagem-overlay {
    position: absolute;
    inset: 0;
    background: rgba(211, 47, 47, .85);
    color: var(--white);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    opacity: 0;
    transition: opacity .2s;
    pointer-events: none;
}

.imagem-card:hover .imagem-overlay {
    opacity: 1;
}

.imagem-overlay i {
    font-size: 2rem;
}

.imagem-overlay p {
    font-size: .85rem;
    font-weight: 500;
    text-align: center;
    padding: 0 12px;
    margin: 0;
}

.imagem-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.imagem-info h3 {
    font-size: .95rem;
    color: var(--dark);
    margin: 0;
}

.imagem-desc {
    font-size: .78rem;
    color: var(--text-light);
    margin: 0;
    line-height: 1.4;
}

.imagem-meta {
    font-size: .72rem;
    color: var(--text-light);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.imagem-meta i { font-size: .7rem; }

.imagem-info .btn {
    margin-top: 8px;
    cursor: pointer;
}

.imagem-help {
    font-size: .7rem;
    color: var(--text-light);
    text-align: center;
    margin: 0;
    font-style: italic;
}

.imagem-feedback {
    font-size: .78rem;
    padding: 8px 10px;
    border-radius: 4px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.imagem-feedback.sucesso {
    background: #e8f5e9;
    color: var(--success);
}

.imagem-feedback.erro {
    background: #ffebee;
    color: var(--danger);
}

/* ============================================================
   MODAL DE NOVA IMAGEM
   ============================================================ */
.modal-overlay-imagem {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .75);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay-imagem.active {
    display: flex;
}

.modal-box-imagem {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .4);
    animation: modalFadeIn .3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(.95) translateY(-10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

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

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

.modal-header-imagem h3 i { color: var(--primary); }

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color .2s;
}

.modal-close-btn:hover { color: var(--primary); }

.modal-box-imagem form {
    padding: 24px;
}

.modal-botoes {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* Mensagens de formulário (para o modal) */
.form-message {
    margin-top: 15px;
    padding: 12px 20px;
    border-radius: 5px;
    display: none;
}

.form-message.success {
    display: block;
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.form-message.error {
    display: block;
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

/* ============================================================
   RESPONSIVO
   ============================================================ */
@media (max-width: 900px) {
    .admin-header-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 16px;
        gap: 12px;
    }
    .admin-nav {
        order: 3;
        width: 100%;
        border-top: 1px solid var(--dark-3);
        padding-top: 12px;
    }
    .admin-user-info { display: none; }
}

@media (max-width: 700px) {
    .imagens-grid-single .imagem-card {
        grid-template-columns: 1fr;
    }
    .imagens-grid-single .imagem-preview {
        min-height: 160px;
        max-height: 200px;
    }
}

@media (max-width: 600px) {
    .admin-main { padding: 20px 16px; }
    .form-row { grid-template-columns: 1fr; }
    .admin-page-header { flex-direction: column; align-items: flex-start; }
    .admin-card { padding: 18px; }
    .admin-nav a span { display: none; }
    .admin-nav a { padding: 10px; }
    .imagens-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }
    .imagem-info { padding: 12px; }
    .imagem-info h3 { font-size: .85rem; }
    .precos-acoes {
        flex-direction: column;
        align-items: stretch;
        padding: 14px 16px;
    }
    .precos-acoes-botoes {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    .modal-box-imagem form { padding: 20px; }
}