/* Catálogo Óptico – Di Vittore */
:root {
    --bg: #f0f2f5;
    --card: #fff;
    --text: #1a1a2e;
    --text-muted: #5c5c7a;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #059669;
    --success-hover: #047857;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --radius: 10px;
}

* { box-sizing: border-box; }
body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.site-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo-text {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text);
    text-decoration: none;
}
.main-nav {
    display: flex;
    gap: 0.5rem;
}
.main-nav a {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
}
.main-nav a:hover { color: var(--primary); background: rgba(37,99,235,0.08); }
.main-nav a.active { color: var(--primary); background: rgba(37,99,235,0.12); }
.main-nav a.nav-pdf { color: var(--success); font-weight: 600; }
.main-nav a.nav-pdf:hover { color: var(--success-hover); background: rgba(5,150,105,0.1); }
.main-nav a.nav-logout { color: var(--text-muted); margin-left: 0.5rem; }
.main-nav a.nav-logout:hover { color: #b91c1c; background: rgba(185,28,28,0.08); }

.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
}
.page-heading {
    font-size: 1.5rem;
    margin: 0 0 1.5rem 0;
    font-weight: 700;
}

/* Dashboard cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}
.dashboard-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    display: block;
    transition: box-shadow 0.2s, transform 0.15s;
}
.dashboard-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}
.dashboard-card h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.15rem;
    font-weight: 600;
}
.dashboard-card p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: var(--success-hover); }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: rgba(37,99,235,0.08); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    max-width: 400px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
}
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-actions { margin-top: 1.5rem; display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* Catalog list */
.catalog-actions { margin-bottom: 1.5rem; }
.catalog-category { margin-bottom: 2.5rem; }
.catalog-category-title {
    font-size: 1.35rem;
    color: var(--primary);
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
}
.catalog-group { margin-bottom: 2rem; }
.catalog-group h3 {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}
.product-list { list-style: none; padding: 0; margin: 0; }
.product-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--card);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
}
.product-item .name { font-weight: 600; }
.product-item .meta { font-size: 0.85rem; color: var(--text-muted); }
.product-item .actions { display: flex; gap: 0.5rem; }

[contenteditable="true"] {
    outline: 2px dashed rgba(37,99,235,0.3);
    padding: 2px 4px;
    border-radius: 2px;
}
[contenteditable="true"]:focus {
    outline-color: var(--primary);
    background: rgba(37,99,235,0.06);
}

.message { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.message.success { background: #d1fae5; color: #065f46; }

.site-footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: var(--card);
}

/* Variation blocks */
.variation-block {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}
.variation-block h4 { margin: 0 0 0.5rem 0; font-size: 0.95rem; }
.measure-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.75rem; }

/* Cor: select + opção "Outra" */
.form-group-color .color-select-wrap { display: flex; flex-direction: column; gap: 0.5rem; }
.form-group-color .color-select { max-width: 280px; }
.form-group-color .color-custom-input { max-width: 280px; margin-top: 0.25rem; }

/* Miniaturas das fotos (upload) */
.thumb-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 0.5rem 0;
}
.variation-images {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.form-group.thumb-upload {
    flex: 0 0 auto;
}
.thumb-box {
    position: relative;
    width: 100px;
    height: 100px;
    border: 2px dashed var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.thumb-box:hover {
    border-color: var(--primary);
    background: #eff6ff;
}
.thumb-box .thumb-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.thumb-box .thumb-placeholder {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    padding: 4px;
    z-index: 0;
}
.thumb-box .thumb-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}
.thumb-box.thumb-dragging {
    opacity: 0.6;
    border-color: var(--primary);
}
.thumb-box.thumb-drag-over {
    border-color: var(--success);
    background: #ecfdf5;
    box-shadow: 0 0 0 2px var(--success);
}
.thumb-box .thumb-fullscreen-btn {
    position: absolute;
    bottom: 4px;
    right: 4px;
    z-index: 2;
    padding: 2px 6px;
    font-size: 0.65rem;
    border: none;
    border-radius: 4px;
    background: rgba(0,0,0,0.65);
    color: #fff;
    cursor: pointer;
    opacity: 0.9;
}
.thumb-box .thumb-fullscreen-btn:hover {
    background: var(--primary);
    opacity: 1;
}
.thumb-box:not(.has-image) .thumb-fullscreen-btn {
    display: none;
}

/* Overlay tela cheia */
.thumb-fullscreen-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s, visibility 0.2s;
}
.thumb-fullscreen-overlay.thumb-fullscreen-open {
    visibility: visible;
    opacity: 1;
}
.thumb-fullscreen-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.85);
    cursor: pointer;
}
.thumb-fullscreen-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.thumb-fullscreen-img {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    background: #000;
    border-radius: 4px;
}
.thumb-fullscreen-close {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    z-index: 10000;
}
.thumb-fullscreen-close:hover {
    background: rgba(255,255,255,0.4);
}

/* Seções de formulário (ex.: página principal) */
.form-section { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.form-section:last-of-type { border-bottom: none; }
.form-section-title { font-size: 1.1rem; margin: 0 0 0.5rem 0; }

/* Painel de marcas */
.brands-panel { display: flex; flex-direction: column; gap: 2rem; }
.brands-form-section, .brands-list-section { max-width: 560px; }
.brands-form-section h2, .brands-list-section h2 { font-size: 1.1rem; margin: 0 0 1rem 0; }
.brand-form .form-hint { font-size: 0.8rem; color: var(--text-muted); display: block; margin-top: 0.25rem; }
.brands-list { list-style: none; padding: 0; margin: 0; }
.brand-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}
.brand-item-logo {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border-radius: 6px;
    overflow: hidden;
}
.brand-item-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.brand-no-logo { font-size: 0.7rem; color: var(--text-muted); }
.brand-item-name { flex: 1; font-weight: 600; }
.brand-current-logo { margin-bottom: 0.5rem; }
.brand-current-logo img { max-height: 60px; width: auto; }

/* Preview do logo no cadastro de nova marca */
.brand-logo-preview-wrap { margin-bottom: 0.5rem; }
.brand-logo-preview {
    position: relative;
    width: 160px;
    height: 100px;
    border: 2px dashed var(--border);
    border-radius: 8px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.brand-logo-placeholder {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    padding: 8px;
}
.brand-logo-preview-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}
