* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    padding: 20px;
}

.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
    padding: 30px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.admin-header h1 {
    color: #333;
    font-size: 2em;
}

.admin-header p {
    color: #666;
}

.btn-back {
    background: #6c757d;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
}

.btn-back:hover {
    background: #5a6268;
}

/* Mensagens */
.message {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Abas */
.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: #f0f0f0;
}

.tab-btn.active {
    background: #667eea;
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Busca */
.admin-search {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.admin-search input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
}

.admin-search input:focus {
    outline: none;
    border-color: #667eea;
}

.admin-search button {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
}

.admin-search button:hover {
    background: #5a6fd6;
}

/* Lista Admin */
.admin-list {
    max-height: 600px;
    overflow-y: auto;
}

.admin-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.3s;
}

.admin-item:hover {
    background: #f8f9fa;
}

.admin-item .item-info {
    flex: 1;
}

.admin-item .item-name {
    font-weight: 600;
    color: #333;
}

.admin-item .item-details {
    font-size: 14px;
    color: #888;
    margin-top: 4px;
}

.admin-item .item-actions {
    display: flex;
    gap: 8px;
}

.admin-item .item-actions button {
    padding: 5px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.btn-edit {
    background: #ffc107;
    color: #333;
}

.btn-edit:hover {
    background: #e0a800;
}

.btn-toggle {
    background: #17a2b8;
    color: white;
}

.btn-toggle:hover {
    background: #138496;
}

.btn-toggle.hidden {
    background: #dc3545;
}

.btn-toggle.hidden:hover {
    background: #c82333;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover {
    background: #c82333;
}

.btn-success {
    background: #28a745;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.btn-success:hover {
    background: #218838;
}

/* Categorias */
.admin-categories h3 {
    margin-bottom: 15px;
    color: #333;
}

.category-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.category-form input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
}

.category-form input:focus {
    outline: none;
    border-color: #667eea;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
}

.category-item .category-name {
    font-weight: 500;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background: white;
    margin: 10% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.close-modal {
    color: #999;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-body .form-group {
    margin-bottom: 15px;
}

.modal-body label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #444;
}

.modal-body textarea,
.modal-body input {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
}

.modal-body textarea {
    min-height: 150px;
    font-family: monospace;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-footer .btn-primary {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
}

.modal-footer .btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #888;
}

@media (max-width: 768px) {
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .admin-tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1;
        text-align: center;
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .admin-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .admin-item .item-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .category-form {
        flex-direction: column;
    }
}

/* Adicionar ao final do arquivo */

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.3s;
}

.category-item:hover {
    background: #f8f9fa;
}

.category-name {
    font-weight: 500;
    font-size: 16px;
}

.category-name.hidden-category {
    color: #dc3545;
}

.hidden-service {
    color: #6c757d;
    font-style: italic;
}

.item-name {
    font-weight: 600;
    color: #333;
}

.item-details {
    font-size: 14px;
    color: #888;
    margin-top: 4px;
}

.item-actions {
    display: flex;
    gap: 8px;
}

.item-actions button {
    padding: 5px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.btn-toggle {
    background: #17a2b8;
    color: white;
}

.btn-toggle:hover {
    background: #138496;
}

.btn-toggle.hidden {
    background: #dc3545;
}

.btn-toggle.hidden:hover {
    background: #c82333;
}

/* ==========================================================
   VARIÁVEIS GLOBAIS DO ADMIN
   ========================================================== */
:root {
    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --text-primary: #333;
    --text-secondary: #666;
    --border-color: #e0e0e0;
    --primary-start: #667eea;
    --primary-end: #764ba2;
    --primary-gradient: linear-gradient(135deg, var(--primary-start), var(--primary-end));
}

/* ==========================================================
   TEMA - CARTÕES E PREVIEWS
   ========================================================== */

.admin-themes h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.theme-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 18px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.theme-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    border-color: var(--primary-start);
}

/* 🎯 Efeito de seleção melhorado */
.theme-card.selected {
    border: 3px solid var(--primary-start);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08), rgba(118, 75, 162, 0.08));
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.25), 0 8px 25px rgba(102, 126, 234, 0.3);
    transform: scale(1.02);
}

/* Ícone de check quando selecionado */
.theme-card.selected::after {
    content: "✔";
    position: absolute;
    top: -10px;
    right: -10px;
    width: 28px;
    height: 28px;
    background: var(--primary-start);
    color: white;
    border-radius: 50%;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.5);
    border: 2px solid white;
}

.theme-card span {
    display: block;
    margin-top: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Preview do tema */
.theme-preview {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    margin: 0 auto 8px;
    border: 2px solid var(--border-color);
    transition: transform 0.3s ease;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.1);
}

.theme-card:hover .theme-preview {
    transform: scale(1.05);
}

.theme-card.selected .theme-preview {
    border-color: var(--primary-start);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* Previews dos temas */
.default-preview {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}
.christmas-preview {
    background: linear-gradient(135deg, #d42c2c 0%, #2d8a4e 100%);
}
.newyear-preview {
    background: linear-gradient(135deg, #f7c948 0%, #f5a623 100%);
}
.easter-preview {
    background: linear-gradient(135deg, #ec407a 0%, #ab47bc 100%);
}
.worldcup-preview {
    background: linear-gradient(135deg, #0b3d0b 0%, #f7c948 100%);
}
.halloween-preview {
    background: linear-gradient(135deg, #ff6b35 0%, #c82333 100%);
}

/* Botão salvar tema */
.theme-save-btn {
    margin-top: 20px;
    padding: 12px 30px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.theme-save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.theme-save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.admin-header h1 {
    color: var(--text-primary);
}

.admin-header p {
    color: var(--text-secondary);
}

.modal-header h3 {
    color: var(--text-primary);
}
/* ============================================
   MELHORIAS DO PAINEL (serviços, categorias, telegram)
   ============================================ */

.check-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
}

.check-inline input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #667eea;
    cursor: pointer;
}

.admin-legenda {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 4px 0 14px;
    line-height: 1.6;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.4px;
    vertical-align: middle;
    margin-left: 4px;
}

.badge-hidden {
    background: #fff3cd;
    color: #8a6d00;
}

.badge-deleted {
    background: #f8d7da;
    color: #842029;
}

.badge-count {
    background: #e7eaf6;
    color: #3b4a7a;
}

.badge-custom {
    background: #d1e7dd;
    color: #0f5132;
}

.original-name {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 400;
    margin-left: 6px;
}

.category-item.is-hidden,
.admin-item.is-unavailable {
    opacity: 0.72;
}

.category-item.is-deleted {
    opacity: 0.55;
    border-left: 3px solid #dc3545;
}

.admin-item.is-unavailable {
    border-left: 3px solid #ffc107;
}

.admin-item .item-details strong {
    color: var(--text-primary);
    font-weight: 600;
}

.form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1 1 140px;
    min-width: 120px;
}

.modal-body select,
.telegram-card select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color, #d8dbe6);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-input, #fff);
    color: var(--text-primary, #222);
}

.btn-primary,
.btn-secondary {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.btn-secondary {
    background: #eef0f7;
    color: #3b4a7a;
}

.btn-primary:hover,
.btn-secondary:hover {
    opacity: 0.9;
}

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

.telegram-card {
    max-width: 720px;
}

.telegram-card .hint {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
}

.telegram-card .form-group {
    margin-bottom: 16px;
}

.telegram-card .form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-primary);
}

.telegram-card .form-group input[type="text"],
.telegram-card .form-group input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color, #d8dbe6);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-input, #fff);
    color: var(--text-primary, #222);
}

.telegram-card small {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 12px;
}

.telegram-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 8px 0 18px;
}

.telegram-status {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 14px;
    font-weight: 600;
}

.telegram-status.ok {
    background: #d1e7dd;
    color: #0f5132;
}

.telegram-status.warn {
    background: #fff3cd;
    color: #8a6d00;
}

.telegram-status.off {
    background: #f1f2f6;
    color: #5a6275;
}

.telegram-help {
    background: #f7f8fc;
    border-radius: 8px;
    padding: 12px 16px;
}

.telegram-help summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
}

.telegram-help ol {
    margin: 10px 0 0 18px;
    font-size: 13px;
    line-height: 1.8;
}

.telegram-help code {
    background: #e9ecf5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    word-break: break-all;
}

/* ============================================
   PEDIDOS / CABEÇALHO
   ============================================ */

.admin-header-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.btn-logout {
    background: #f8d7da;
    color: #842029;
}

.orders-summary {
    margin: 4px 0 12px;
    color: var(--text-secondary, #6a7186);
    font-size: 14px;
    font-weight: 600;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid #e6e8f0;
    border-radius: 12px;
    background: var(--bg-card, #fff);
}

.orders-table {
    width: 100%;
    min-width: 940px;
    border-collapse: collapse;
    font-size: 13px;
}

.orders-table th {
    padding: 12px 10px;
    text-align: left;
    background: #f6f7fb;
    color: #3b4a7a;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.orders-table td {
    padding: 10px;
    border-top: 1px solid #eef0f6;
    vertical-align: top;
    color: var(--text-primary, #1d2233);
}

.orders-table tr:hover td {
    background: #fafbff;
}

.orders-table a {
    color: #667eea;
    text-decoration: none;
    word-break: break-all;
}

.orders-table small {
    color: var(--text-secondary, #6a7186);
    font-size: 11px;
}

.status-cell {
    margin-top: 6px;
    font-size: 12px;
    color: #3b4a7a;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin: 16px 0 4px;
    font-size: 14px;
    color: var(--text-secondary, #6a7186);
}

.pagination button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ============================================
   TELEGRAM — descoberta de chat
   ============================================ */

.telegram-chats {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #e2e5ef;
    border-radius: 10px;
    background: #fafbff;
    font-size: 13px;
}

.chat-option.selected {
    border-color: #667eea;
    background: #eef1ff;
}

.chat-option small {
    color: var(--text-secondary, #6a7186);
    font-size: 11px;
}

.chat-option .btn-usar-chat {
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 12px;
}

.admin-toolbar {
    margin-bottom: 12px;
}
