* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: #f5f5f5;
    color: #333;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 1.8rem;
}

.box-link-tv {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.box-link-tv label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 6px;
    opacity: 0.95;
}

.link-tv-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.box-link-tv input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 0.9rem;
}

.btn-copiar {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap;
}

.btn-copiar:hover {
    background: rgba(255, 255, 255, 0.35);
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 2px solid #fff;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Content */
.content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: #fff;
    border-right: 1px solid #e0e0e0;
    padding: 20px 0;
}

.nav-btn {
    width: 100%;
    padding: 15px 30px;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-size: 1rem;
    color: #666;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.nav-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.nav-btn.active {
    background: #f0f0ff;
    color: #667eea;
    border-left-color: #667eea;
    font-weight: bold;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

.section h2 {
    margin-bottom: 20px;
    color: #333;
}

.section-desc {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.btn-primary {
    background: #667eea;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    margin-bottom: 20px;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    padding: 8px 16px;
    font-size: 0.9rem;
    border: 2px solid #667eea;
    background: transparent;
    color: #667eea;
    border-radius: 5px;
    cursor: pointer;
}
.btn-secondary:hover {
    background: #f0f0ff;
}
.btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Lista de Ofertas */
.lista-ofertas {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.oferta-item {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.oferta-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.oferta-item h3 {
    color: #333;
    margin-bottom: 10px;
}

.oferta-item p {
    color: #666;
    margin-bottom: 15px;
}

.oferta-item .preco {
    font-size: 1.5rem;
    font-weight: bold;
    color: #e74c3c;
    margin-bottom: 15px;
}

.oferta-item .acoes {
    display: flex;
    gap: 10px;
}

.btn-edit, .btn-delete {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.btn-edit {
    background: #3498db;
    color: #fff;
}

.btn-edit:hover {
    background: #2980b9;
}

.btn-delete {
    background: #e74c3c;
    color: #fff;
}

.btn-delete:hover {
    background: #c0392b;
}

/* Lista de Categorias */
.lista-categorias {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.categoria-item {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-left: 5px solid;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #fff;
    border-radius: 10px;
    padding: 30px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

/* Logo do supermercado (configurações) */
.logo-upload-area {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 16px;
}

.logo-preview-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.logo-preview-img {
    max-height: 80px;
    max-width: 200px;
    object-fit: contain;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #f9f9f9;
}

.btn-remover-logo {
    padding: 6px 12px;
    font-size: 0.85rem;
    color: #c0392b;
    background: transparent;
    border: 1px solid #c0392b;
    border-radius: 5px;
    cursor: pointer;
}

.btn-remover-logo:hover {
    background: #c0392b;
    color: #fff;
}

.logo-upload-area-inner {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.logo-upload-area-inner input[type="file"] {
    padding: 6px 0;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-group input[type="file"] {
    padding: 8px;
    border: 2px dashed #e0e0e0;
    border-radius: 5px;
    background: #f9f9f9;
    cursor: pointer;
    transition: all 0.3s;
}

.form-group input[type="file"]:hover {
    border-color: #667eea;
    background: #f0f0ff;
}

#imagem_preview img {
    display: block;
    margin-top: 10px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn-cancel {
    background: #95a5a6;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.btn-cancel:hover {
    background: #7f8c8d;
}

/* Encartes */
.encarte-builder {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

@media (max-width: 900px) {
    .encarte-builder {
        grid-template-columns: 1fr;
    }
}

.encarte-controls {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    min-width: 0;
}

.encarte-preview {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #ddd;
    min-width: 0;
    min-height: 420px;
}

.encarte-preview h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

/* Lista de ofertas do encarte */
#encarte_ofertas_list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 120px;
    max-height: 380px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
}

.encarte-oferta-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.encarte-oferta-item:hover {
    background: #f5f5f5;
    border-color: #667eea;
}

.encarte-oferta-item:has(.oferta-encarte:checked) {
    background: #e8ecff;
    border-color: #667eea;
}

.encarte-oferta-thumb {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.encarte-oferta-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.encarte-oferta-icon {
    font-size: 1.5rem;
}

.encarte-oferta-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.encarte-oferta-info strong {
    font-size: 0.95rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.encarte-oferta-info em {
    font-size: 0.9rem;
    color: #667eea;
    font-weight: 600;
    font-style: normal;
}

.imagem-item:hover {
    border-color: #667eea !important;
    transform: scale(1.05);
    transition: all 0.2s;
}

/* Oferta Item */
.oferta-info {
    flex: 1;
}

.oferta-detalhes {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 10px 0;
    align-items: center;
}

.categoria-badge {
    padding: 5px 12px;
    border-radius: 20px;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
}

.preco-original {
    text-decoration: line-through;
    color: #999;
    font-size: 1rem;
}

.desconto {
    background: #e74c3c;
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.85rem;
    font-weight: bold;
}

.oferta-status {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    align-items: center;
}

.status {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status.ativo {
    background: #d4edda;
    color: #155724;
}

.status.inativo {
    background: #f8d7da;
    color: #721c24;
}

.destaque-badge {
    background: #ffc107;
    color: #333;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.85rem;
    font-weight: bold;
}

.oferta-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

/* Categoria Item */
.categoria-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.categoria-cor {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #e0e0e0;
}

.categoria-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Licença */
.licenca-status {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.status-ok {
    color: #155724;
}

.status-ok h3 {
    color: #155724;
    margin-bottom: 10px;
}

.status-error {
    color: #721c24;
}

.status-error h3 {
    color: #721c24;
    margin-bottom: 10px;
}

.licenca-form {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.licenca-form h3 {
    margin-bottom: 20px;
    color: #333;
}

/* Responsive */
@media (max-width: 768px) {
    .content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .oferta-item {
        flex-direction: column;
    }

    .categoria-item {
        flex-direction: column;
        align-items: flex-start;
    }
}
