:root {
    --bg-black: #0a0a0a;
    --sidebar-bg: #000000;
    --input-bg: #1a1a1a;
    --accent-red: #ff4d4d;
    --accent-blue: #0071e3;
    --text-white: #ffffff;
    --text-gray: #86868b;
    --border-color: #333;
}

* { box-sizing: border-box; }

body {
    background-color: var(--bg-black);
    color: var(--text-white);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
}

.admin-container { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 25px;
    display: flex;
    flex-direction: column;
}

.logo-preview-container {
    background: white;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 40px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.logo-preview-container img { max-width: 100%; max-height: 100%; object-fit: contain; }

.side-nav { display: flex; flex-direction: column; gap: 8px; }

.nav-btn {
    background: none; border: none; color: var(--text-white);
    text-align: left; padding: 14px 18px; cursor: pointer;
    font-weight: 600; border-radius: 10px; font-size: 13px;
    transition: 0.2s;
}

.nav-btn.active, .nav-btn:hover { background: var(--input-bg); }

.btn-sair {
    background: var(--accent-red); color: white;
    text-decoration: none; padding: 15px; text-align: center;
    border-radius: 15px; margin-top: auto; font-weight: bold; font-size: 14px;
}

/* Conteúdo */
.admin-content {
    flex: 1;
    width: 100%;
    max-width: none;
    padding: 48px;
}

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

h2 {
    font-size: 18px;
    letter-spacing: 1px;
    margin: 0 0 24px;
    color: #fff;
}

/* Formulário */
.admin-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.upload-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(240px, 0.7fr);
    gap: 24px;
    align-items: stretch;
}

.form-section,
.preview-section,
.tab-content,
.preview-box {
    min-width: 0;
}

.form-section {
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015));
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 18px 40px rgba(0,0,0,0.25);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.preview-section {
    position: sticky;
    top: 24px;
    height: 100%;
    display: flex;
}

.preview-box {
    width: 100%;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015));
    border: 1px dashed rgba(255,255,255,0.12);
    border-radius: 18px;
    padding: 20px;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.upload-grid .form-row {
    display: block;
    width: 100%;
    margin-bottom: 16px;
}

.upload-grid .form-row > div {
    width: 100%;
}

.title-value-row,
.brand-pages-row {
    display: grid;
    grid-template-columns: minmax(0, 75%) minmax(0, 25%);
    gap: 16px;
    align-items: start;
}

.brand-field,
.pages-field {
    min-width: 0;
}

.pages-field input {
    width: 100%;
}

.form-section label {
    display: block;
    font-size: 12px;
    color: #e6e6e6;
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
}

input, select, textarea {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    padding: 16px;
    color: white;
    border-radius: 12px;
    font-size: 14px;
}

textarea {
    min-height: 140px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--text-gray);
    outline: none;
}

.btn-upload {
    display: block;
    width: 100%;
    background: var(--input-bg);
    border: 1px dashed var(--border-color);
    color: var(--text-gray);
    padding: 16px;
    text-align: center;
    border-radius: 12px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.btn-upload:hover {
    border-color: rgba(255,255,255,0.25);
    color: #fff;
}

.btn-publicar {
    background: white;
    color: black;
    border: none;
    padding: 18px;
    font-weight: bold;
    border-radius: 12px;
    cursor: pointer;
    text-transform: uppercase;
    margin-top: 4px;
    transition: 0.2s;
}

.btn-publicar:hover { background: #ccc; }
.btn-publicar:disabled { background: #555; cursor: not-allowed; }

.thumb-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.thumb-column img {
    width: 240px;
    height: auto;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 10px 24px rgba(0,0,0,0.55);
}

.thumb-filename {
    font-size: 13px;
    color: var(--text-gray);
    max-width: 260px;
    text-align: center;
    word-break: break-word;
}

.required-star { color: var(--accent-red) !important; margin-left: 6px; display: inline-block; }
.obs-note { font-size: 13px; color: rgba(255,255,255,0.72); margin-top: 8px; }

.preview-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-remove {
    background: transparent;
    color: var(--accent-red);
    border: 1px solid rgba(255,255,255,0.12);
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
}

.spinner {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.08);
    border-top-color: var(--accent-blue);
    animation: spin 1s linear infinite;
}

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

/* Estoque List */
.estoque-header, .estoque-row {
    display: grid;
    grid-template-columns: 1fr 100px 100px;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}
.estoque-header { font-weight: bold; color: var(--text-gray); font-size: 12px; }
.estoque-row input { padding: 8px; text-align: center; }
.btn-delete { background: none; border: 1px solid var(--accent-red); color: var(--accent-red); padding: 5px; cursor: pointer; border-radius: 5px; }

@media (max-width: 720px) {
    .admin-content { padding: 24px; }
    .upload-grid { grid-template-columns: 1fr; }
    .preview-section { position: static; }
    .upload-grid .form-row { display: block; }
    .brand-pages-row { grid-template-columns: 1fr; }
    .thumb-column img { width: 200px; }
}

@media (max-width: 680px) {
    .sidebar { width: auto; }
    .admin-container { flex-direction: column; }
    .form-section,
    .preview-box {
        padding: 18px;
        border-radius: 14px;
    }
}


.pdf-placeholder {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.pdf-placeholder svg {
    width: 180px;
    height: 180px;
    display: block;
}

.pdf-placeholder-label {
    font-size: 13px;
    color: var(--text-gray);
    text-align: center;
    max-width: 220px;
    word-break: break-word;
}
