/* ControlPot - Estilo WhatsApp */

:root {
    --whatsapp-green: #25D366;
    --whatsapp-dark: #128C7E;
    --whatsapp-light: #DCF8C6;
    --bg-chat: #ECE5DD;
    --text-dark: #1F1F1F;
    --text-light: #666;
    --border: #E0E0E0;
    --white: #FFFFFF;
    --status-ok: #10B981;
    --status-warning: #F59E0B;
    --status-error: #EF4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-chat);
    color: var(--text-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Auth Page */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--whatsapp-green) 0%, var(--whatsapp-dark) 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-box {
    background: var(--white);
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo h1 {
    font-size: 32px;
    color: var(--whatsapp-dark);
    margin-bottom: 5px;
}

.logo p {
    color: var(--text-light);
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 14px;
}

.login-form input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--whatsapp-green);
}

.login-form small {
    display: block;
    margin-top: 5px;
    color: var(--text-light);
    font-size: 12px;
}

.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--whatsapp-green);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--whatsapp-dark);
}

.btn-link {
    display: block;
    text-align: center;
    margin-top: 15px;
    color: var(--whatsapp-green);
    text-decoration: none;
    font-size: 14px;
}

.otp-result {
    margin-top: 20px;
    padding: 15px;
    background: var(--whatsapp-light);
    border-radius: 8px;
    text-align: center;
}

.otp-code {
    font-size: 24px;
    font-weight: bold;
    color: var(--whatsapp-dark);
    margin-bottom: 5px;
}

.otp-expires {
    font-size: 12px;
    color: var(--text-light);
}

.alert {
    padding: 12px;
    border-radius: 8px;
    margin-top: 15px;
}

.alert-error {
    background: #FEE;
    color: #C33;
    border: 1px solid #FCC;
}

/* Header */
.app-header {
    background: var(--whatsapp-dark);
    color: var(--white);
    padding: 15px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 100%;
}

.header-content h1 {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
    text-align: center;
}

.btn-back, .btn-logout {
    color: var(--white);
    text-decoration: none;
    font-size: 18px;
    padding: 5px 10px;
}

/* Mixers List (Franqueado) */
.mixers-list {
    padding: 10px;
}

.mixer-item {
    background: var(--white);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.mixer-item:active {
    transform: scale(0.98);
}

.mixer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.mixer-codigo {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
}

.mixer-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

.mixer-status-icon {
    font-size: 12px;
}

.mixer-selo {
    margin: 8px 0;
}

.selo {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.selo-premium {
    background: #FFD700;
    color: #000;
}

.selo-externo {
    background: #FFA500;
    color: #000;
}

.selo-fora-prazo {
    background: #F44336;
    color: #FFF;
}

.selo-fora-padrao {
    background: #D32F2F;
    color: #FFF;
}

.selo-ok {
    background: #4CAF50;
    color: #FFF;
}

.mixer-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.mixer-ultima-msg {
    font-size: 13px;
    color: var(--text-light);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mixer-badge {
    background: var(--whatsapp-green);
    color: var(--white);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

/* Chat */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
    background: var(--bg-chat);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    padding-bottom: 80px;
}

.message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.message.sistema {
    align-items: center;
}

.message.sistema .message-bubble {
    background: rgba(0,0,0,0.05);
    color: var(--text-light);
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    max-width: 80%;
    text-align: center;
}

.message.usuario {
    align-items: flex-end;
}

.message.outro {
    align-items: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 10px 12px;
    border-radius: 8px;
    word-wrap: break-word;
    position: relative;
}

.message.usuario .message-bubble {
    background: var(--whatsapp-light);
    color: var(--text-dark);
    border-bottom-right-radius: 2px;
}

.message.outro .message-bubble {
    background: var(--white);
    color: var(--text-dark);
    border-bottom-left-radius: 2px;
}

.message-time {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 3px;
    padding: 0 5px;
}

.message-image, .message-video {
    max-width: 100%;
    border-radius: 8px;
    margin-bottom: 5px;
}

.message-video {
    width: 100%;
    height: auto;
}

/* Chat Input */
.chat-input-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    padding: 10px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input-actions {
    display: flex;
    gap: 5px;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    color: var(--text-light);
}

.chat-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: 25px;
    font-size: 15px;
    outline: none;
}

.chat-input:focus {
    border-color: var(--whatsapp-green);
}

.btn-send {
    background: var(--whatsapp-green);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .login-box {
        padding: 30px 20px;
    }
    
    .mixer-item {
        padding: 12px;
    }
}

/* Loading */
.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-light);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.3);
}

/* ============================================
   MELHORIAS DO SISTEMA
   ============================================ */

/* Badge de Notificações */
.notificacoes-badge-container {
    position: relative;
    margin-right: 10px;
}

.btn-notificacoes {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    color: inherit;
}

.btn-notificacoes:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.notificacoes-icon {
    font-size: 20px;
}

.notificacoes-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #EF4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    border: 2px solid var(--white);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Modo Escuro */
.btn-dark-mode {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    margin-right: 10px;
}

.btn-dark-mode:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.dark-mode-icon {
    font-size: 20px;
}

/* Tema Escuro */
body.dark-mode {
    background: #1a1a1a;
    color: #e0e0e0;
}

body.dark-mode .app-header {
    background: #2d2d2d;
    border-bottom: 1px solid #404040;
}

body.dark-mode .dashboard-card,
body.dark-mode .card,
body.dark-mode .box {
    background: #2d2d2d;
    border-color: #404040;
    color: #e0e0e0;
}

body.dark-mode input,
body.dark-mode textarea,
body.dark-mode select {
    background: #2d2d2d;
    border-color: #404040;
    color: #e0e0e0;
}

body.dark-mode .btn-primary {
    background: #3b82f6;
}

body.dark-mode .btn-primary:hover {
    background: #2563eb;
}

/* Busca Global */
.busca-global-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 100px;
}

.busca-global-container.active {
    display: flex;
}

.busca-global-box {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 70vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

body.dark-mode .busca-global-box {
    background: #2d2d2d;
    color: #e0e0e0;
}

.busca-global-input {
    width: 100%;
    padding: 20px;
    font-size: 18px;
    border: none;
    border-bottom: 2px solid #e0e0e0;
    outline: none;
}

body.dark-mode .busca-global-input {
    background: #2d2d2d;
    color: #e0e0e0;
    border-bottom-color: #404040;
}

.busca-global-results {
    max-height: calc(70vh - 80px);
    overflow-y: auto;
    padding: 10px;
}

.busca-global-item {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: background 0.2s;
}

body.dark-mode .busca-global-item {
    border-bottom-color: #404040;
}

.busca-global-item:hover {
    background: #f5f5f5;
}

body.dark-mode .busca-global-item:hover {
    background: #404040;
}

.busca-global-item-tipo {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    font-weight: bold;
}

body.dark-mode .busca-global-item-tipo {
    color: #999;
}

.busca-global-item-titulo {
    font-size: 16px;
    font-weight: 500;
    margin-top: 5px;
}

/* Gráficos */
.chart-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.dark-mode .chart-container {
    background: #2d2d2d;
}

/* Chat na OS */
.os-comentarios {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

body.dark-mode .os-comentarios {
    border-top-color: #404040;
}

.os-comentario {
    padding: 15px;
    margin-bottom: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid #25D366;
}

body.dark-mode .os-comentario {
    background: #404040;
}

.os-comentario-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.os-comentario-autor {
    font-weight: bold;
    color: #25D366;
}

.os-comentario-data {
    font-size: 12px;
    color: #666;
}

body.dark-mode .os-comentario-data {
    color: #999;
}

.os-comentario-form {
    margin-top: 20px;
}

.os-comentario-form textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    resize: vertical;
}

body.dark-mode .os-comentario-form textarea {
    background: #2d2d2d;
    border-color: #404040;
    color: #e0e0e0;
}

/* Progresso de Cursos */
.curso-progresso {
    margin-top: 15px;
}

.curso-progresso-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

body.dark-mode .curso-progresso-bar {
    background: #404040;
}

.curso-progresso-fill {
    height: 100%;
    background: linear-gradient(90deg, #25D366, #128C7E);
    transition: width 0.3s;
}

.curso-progresso-texto {
    font-size: 14px;
    color: #666;
    text-align: right;
}

body.dark-mode .curso-progresso-texto {
    color: #999;
}

/* Favoritos */
.btn-favorito {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 24px;
    transition: transform 0.2s;
}

.btn-favorito:hover {
    transform: scale(1.2);
}

.btn-favorito.ativo {
    color: #FFD700;
}

/* Preview de Vídeo */
.video-thumbnail {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.video-thumbnail:hover {
    transform: scale(1.02);
}

.video-duracao {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
}

/* Histórico de Atividades */
.historico-item {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 15px;
}

body.dark-mode .historico-item {
    border-bottom-color: #404040;
}

.historico-item-icone {
    font-size: 24px;
}

.historico-item-conteudo {
    flex: 1;
}

.historico-item-data {
    font-size: 12px;
    color: #666;
}

body.dark-mode .historico-item-data {
    color: #999;
}

/* Avaliação de Cursos */
.avaliacao-estrelas {
    display: flex;
    gap: 5px;
    margin: 10px 0;
}

.estrela {
    font-size: 24px;
    color: #ddd;
    cursor: pointer;
    transition: color 0.2s;
}

.estrela.ativa,
.estrela:hover {
    color: #FFD700;
}

/* ============================================
   NOTIFICAÇÕES OFFLINE/ONLINE
   ============================================ */

.offline-notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #F59E0B;
    color: white;
    padding: 12px 20px;
    text-align: center;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    animation: slideDown 0.3s ease;
}

.offline-notification-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    max-width: 1200px;
    margin: 0 auto;
}

.offline-icon {
    font-size: 20px;
}

.offline-text {
    font-size: 14px;
    font-weight: 500;
}

.sync-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: #10B981;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    animation: slideInRight 0.3s ease;
}

.sync-notification-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sync-icon {
    font-size: 18px;
}

.sync-text {
    font-size: 14px;
    font-weight: 500;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

body.dark-mode .offline-notification {
    background: #92400E;
}

body.dark-mode .sync-notification {
    background: #059669;
}

/* Compartilhamento */
.btn-compartilhar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #25D366;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-compartilhar:hover {
    background: #128C7E;
}

/* Sugestões Inteligentes */
.sugestao-card {
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: transform 0.2s;
}

.sugestao-card:hover {
    transform: translateY(-2px);
}

.sugestao-card-tipo {
    font-size: 12px;
    opacity: 0.9;
    text-transform: uppercase;
}

.sugestao-card-titulo {
    font-size: 16px;
    font-weight: bold;
    margin: 5px 0;
}

.sugestao-card-mensagem {
    font-size: 14px;
    opacity: 0.9;
}

