* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f7fa;
    color: #2c3e50;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

header h1 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 28px;
}

nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 10px 20px;
    border: none;
    background: #ecf0f1;
    color: #2c3e50;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.nav-btn:hover {
    background: #bdc3c7;
}

.nav-btn.active {
    background: #3498db;
    color: white;
}

.section {
    display: none;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    min-height: 400px;
}

.section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    color: #2c3e50;
    font-size: 24px;
}

.btn-primary {
    background: #2c3e50;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: #34495e;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-danger {
    background: #e74c3c;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-warning {
    background: #f39c12;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

.btn-warning:hover {
    background: #e67e22;
}

.btn-success {
    background: #27ae60;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

.btn-success:hover {
    background: #229954;
}

.btn-select-all {
    background: #3498db;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    margin-bottom: 10px;
    transition: all 0.3s;
}

.btn-select-all:hover {
    background: #2980b9;
}

/* Formulários */
.form {
    max-width: 1200px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.checkboxes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
    max-height: 300px;
    overflow-y: auto;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-item input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

.checkbox-item label {
    margin: 0;
    cursor: pointer;
    font-weight: normal;
}

.warning {
    color: #e67e22;
    font-size: 13px;
    margin: 10px 0;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

/* Lista de Automações */
.automations-list {
    display: grid;
    gap: 20px;
}

.automation-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    background: #fafafa;
}

.automation-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.automation-info h3 {
    color: #2c3e50;
    margin-bottom: 5px;
}

.automation-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.automation-status.active {
    background: #d4edda;
    color: #155724;
}

.automation-status.inactive {
    background: #f8d7da;
    color: #721c24;
}

.automation-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
    font-size: 14px;
}

.detail-item {
    color: #666;
}

.detail-item strong {
    color: #2c3e50;
}

.automation-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Lista de Números */
.numbers-list {
    display: grid;
    gap: 15px;
}

.number-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
}

.number-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.number-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.number-status.connected {
    background: #d4edda;
    color: #155724;
}

.number-status.disconnected {
    background: #f8d7da;
    color: #721c24;
}

.number-actions {
    display: flex;
    gap: 10px;
}

/* Lista de Grupos */
.groups-list {
    display: grid;
    gap: 15px;
}

.group-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
}

.group-info h3 {
    color: #2c3e50;
    margin-bottom: 5px;
}

.group-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: #d4edda;
    color: #155724;
}

/* Lista de Lojas */
.stores-list {
    display: grid;
    gap: 20px;
}

.store-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    background: #fafafa;
}

.store-card h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.store-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #2196F3;
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.store-config {
    display: grid;
    gap: 15px;
}

/* 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);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

/* Responsivo */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 22px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .checkboxes-grid {
        grid-template-columns: 1fr;
    }

    .automation-details {
        grid-template-columns: 1fr;
    }

    .automation-actions {
        flex-direction: column;
    }

    .automation-actions button {
        width: 100%;
    }
}

/* CTAs e Templates */
.ctas-list, .templates-list {
    display: grid;
    gap: 15px;
}

.cta-card, .template-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    background: #fafafa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cta-info h3 {
    color: #2c3e50;
    margin-bottom: 5px;
    font-size: 18px;
}

.cta-emoji {
    font-size: 24px;
    margin-left: 10px;
}

.cta-actions, .template-actions {
    display: flex;
    gap: 10px;
}

.template-card {
    flex-direction: column;
    align-items: flex-start;
}

.template-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 15px;
}

.template-info h3 {
    color: #2c3e50;
    margin-bottom: 5px;
}

.template-store {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: #e3f2fd;
    color: #1976d2;
    margin-top: 5px;
}

.template-content {
    background: white;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
    width: 100%;
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 13px;
    color: #555;
    max-height: 200px;
    overflow-y: auto;
}

.modal-content textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: monospace;
    resize: vertical;
}

.modal-content textarea:focus {
    outline: none;
    border-color: #3498db;
}


/* Header e User Info */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info span {
    color: #666;
    font-size: 14px;
}

.btn-logout {
    padding: 8px 16px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.btn-logout:hover {
    background: #c0392b;
}

/* QR Code Modal */
.qrcode-modal-content {
    max-width: 500px;
    text-align: center;
}

.qrcode-status {
    font-size: 16px;
    font-weight: 500;
    color: #2c3e50;
    margin: 20px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
}

.qrcode-container {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
}

.qrcode-container img {
    max-width: 100%;
    height: auto;
}

.qrcode-instructions {
    text-align: left;
    color: #666;
    font-size: 14px;
    line-height: 1.8;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
}

.qrcode-loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.qrcode-success {
    color: #27ae60;
    font-size: 18px;
    font-weight: bold;
}

.qrcode-error {
    color: #e74c3c;
    font-size: 16px;
}

.hidden {
    display: none !important;
}


/* Admin - User Cards */
.users-list {
    display: grid;
    gap: 20px;
}

.user-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.user-info {
    flex: 1;
    min-width: 250px;
}

.user-info h3 {
    margin: 0 0 10px 0;
    color: #2c3e50;
}

.user-info p {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
}

.user-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}
}

.status-active {
    color: #27ae60;
    font-weight: bold;
}

.status-inactive {
    color: #e74c3c;
    font-weight: bold;
}

.hidden {
    display: none !important;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-logout {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn-logout:hover {
    background: #c0392b;
}


/* Animações para modal */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}


/* ==================== RESPONSIVIDADE MOBILE ==================== */

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header {
        padding: 15px;
        margin-bottom: 15px;
    }

    header h1 {
        font-size: 22px;
        margin-bottom: 15px;
    }

    .header-content {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start !important;
    }

    .user-info {
        width: 100%;
        justify-content: space-between;
    }

    .user-info span {
        font-size: 12px;
    }

    nav {
        gap: 8px;
    }

    .nav-btn {
        padding: 8px 12px;
        font-size: 12px;
        flex: 1 1 auto;
        min-width: fit-content;
    }

    .section {
        padding: 15px;
        min-height: auto;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .section-header h2 {
        font-size: 20px;
    }

    .btn-primary, .btn-secondary, .btn-danger {
        width: 100%;
        padding: 10px 16px;
        font-size: 14px;
    }

    .form-row {
        flex-direction: column;
    }

    .form-group {
        margin-bottom: 15px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Evita zoom no iOS */
    }

    .checkboxes-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .automations-list {
        gap: 15px;
    }

    .automation-card {
        padding: 15px;
    }

    .automation-header h3 {
        font-size: 16px;
    }

    .automation-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .automation-actions button {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
        padding: 8px;
        font-size: 12px;
    }

    .whatsapp-numbers {
        grid-template-columns: 1fr;
    }

    .number-card {
        padding: 15px;
    }

    .groups-grid {
        grid-template-columns: 1fr;
    }

    .group-card {
        padding: 15px;
    }

    .stores-grid {
        grid-template-columns: 1fr;
    }

    .store-card {
        padding: 15px;
    }

    .ctas-grid {
        grid-template-columns: 1fr;
    }

    .cta-card {
        padding: 15px;
    }

    .modal-content {
        width: 95%;
        margin: 20px auto;
        padding: 20px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-close {
        font-size: 24px;
        top: 10px;
        right: 10px;
    }

    .qr-code-container {
        padding: 15px;
    }

    .qr-code-container canvas {
        max-width: 100%;
        height: auto !important;
    }

    /* Admin section - User cards */
    .user-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .user-info {
        width: 100%;
    }

    .user-actions {
        width: 100%;
        flex-direction: row;
        gap: 10px;
    }

    .user-actions button {
        flex: 1;
        font-size: 13px;
        padding: 10px;
    }

    /* Admin section - Tables */
    .users-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .users-table {
        min-width: 600px;
    }

    .users-table th,
    .users-table td {
        padding: 8px;
        font-size: 12px;
    }
}
}

@media (max-width: 480px) {
    header h1 {
        font-size: 18px;
    }

    .nav-btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .section-header h2 {
        font-size: 18px;
    }

    .automation-card,
    .number-card,
    .group-card,
    .store-card,
    .cta-card {
        padding: 12px;
    }

    .modal-content {
        padding: 15px;
    }

    /* Ajustes para telas muito pequenas */
    .form-group label {
        font-size: 14px;
    }

    .btn-select-all {
        font-size: 12px;
        padding: 8px;
    }
}

/* Melhorias de toque para mobile */
@media (hover: none) and (pointer: coarse) {
    .nav-btn,
    .btn-primary,
    .btn-secondary,
    .btn-danger,
    button {
        min-height: 44px; /* Tamanho mínimo recomendado para toque */
    }

    .checkbox-item {
        min-height: 44px;
        padding: 12px;
    }
}

/* Info Box */
.info-box {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.info-box p {
    margin: 0;
    line-height: 1.6;
}

.info-box a {
    font-weight: 600;
    text-decoration: underline;
}

.info-box a:hover {
    text-decoration: none;
}
