/* frontend/public/css/style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
}

/* ============================================
   LOGIN
============================================ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header .logo {
    font-size: 48px;
    display: block;
    margin-bottom: 10px;
}

.login-header h1 {
    color: #1a1a2e;
    font-size: 24px;
}

.login-header p {
    color: #718096;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #2d3748;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-error {
    background: #fff5f5;
    color: #c53030;
    border: 1px solid #feb2b2;
}

/* ============================================
   PAINEL
============================================ */
.app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 20px;
}

.sidebar-header span {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    cursor: pointer;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.sidebar-nav a.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: #25D366;
}

.sidebar-nav a i {
    width: 20px;
    margin-right: 12px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer button {
    width: 100%;
    padding: 10px;
    background: rgba(255, 0, 0, 0.2);
    color: #ff6b6b;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.sidebar-footer button:hover {
    background: rgba(255, 0, 0, 0.3);
}

/* Main Content */
.main-content {
    margin-left: 260px;
    flex: 1;
}

.main-header {
    background: white;
    padding: 16px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-right {
    font-weight: 600;
    color: #2d3748;
}

.content {
    padding: 24px 30px;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.stat-icon.blue {
    background: #4299e1;
}

.stat-icon.green {
    background: #48bb78;
}

.stat-icon.orange {
    background: #ed8936;
}

.stat-icon.whatsapp {
    background: #25D366;
}

.stat-info h3 {
    font-size: 24px;
}

.stat-info p {
    color: #718096;
    font-size: 14px;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.card-header h3 {
    font-size: 18px;
}

.card-body {
    padding: 20px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn:hover {
    transform: translateY(-1px);
}

/* Botão Conectar */
.btn-success {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #1da851 0%, #0e6b5f 100%);
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
}

/* Botão Desconectar */
.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c82333 0%, #a71d2a 100%);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
}

/* Botão Forçar Reconexão */
.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #212529;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #e0a800 0%, #c49200 100%);
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.4);
}

/* Botão Atualizar (pequeno) */
.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-outline {
    background: transparent;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.btn-outline:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.btn-warning i {
    color: #212529;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
}

/* ============================================
   WHATSAPP MODULE
============================================ */

.whatsapp-status-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 16px;
    border: 1px solid #dee2e6;
}

.status-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.status-icon i {
    font-size: 32px;
}

.status-icon i.fa-circle {
    font-size: 40px;
}

.status-info {
    flex: 1;
}

.status-info h4 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.status-info p {
    margin: 4px 0 0;
    color: #6c757d;
    font-size: 14px;
}

.status-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 16px;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 160px;
}

.btn-lg:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-lg:active {
    transform: translateY(0);
}

.btn-lg:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Details Grid */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.detail-item {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.detail-label {
    display: block;
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 16px;
    font-weight: 600;
    color: #212529;
}

/* QR Code */
.qr-card {
    background: white;
    border-radius: 16px;
    border: 1px solid #dee2e6;
    overflow: hidden;
}

.qr-header {
    padding: 20px 24px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
}

.qr-header h4 {
    margin: 0;
    font-size: 18px;
}

.qr-header p {
    margin: 4px 0 0;
    opacity: 0.9;
    font-size: 14px;
}

.qr-body {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    padding: 24px;
    justify-content: center;
    align-items: center;
}

.qr-wrapper {
    position: relative;
    width: 200px;
    height: 200px;
    border: 2px solid #dee2e6;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.qr-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    gap: 8px;
}

.qr-loading i {
    font-size: 32px;
    color: #25D366;
}

.qr-loading span {
    font-size: 14px;
    color: #6c757d;
}

.qr-instructions {
    flex: 1;
    min-width: 200px;
}

.qr-instructions ol {
    padding-left: 20px;
    margin: 0 0 12px;
    color: #495057;
}

.qr-instructions ol li {
    margin-bottom: 8px;
    font-size: 14px;
}

.qr-timer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid #e9ecef;
}

.qr-timer span {
    font-size: 14px;
    color: #6c757d;
}

.qr-timer span strong {
    color: #dc3545;
}

.qr-footer {
    padding: 12px 24px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.qr-footer .text-muted {
    margin: 0;
    font-size: 13px;
}

/* Event List */
.event-list {
    max-height: 200px;
    overflow-y: auto;
}

.event-item {
    padding: 8px 12px;
    border-bottom: 1px solid #f1f3f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.event-item:last-child {
    border-bottom: none;
}

.event-item .event-time {
    font-size: 12px;
    color: #6c757d;
}

.event-item .event-text {
    font-size: 14px;
}

.event-item .event-badge {
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.event-badge.success {
    background: #d4edda;
    color: #155724;
}

.event-badge.danger {
    background: #f8d7da;
    color: #721c24;
}

.event-badge.warning {
    background: #fff3cd;
    color: #856404;
}

.event-badge.info {
    background: #d1ecf1;
    color: #0c5460;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

/* Responsive */
@media (max-width: 768px) {
    .whatsapp-status-card {
        flex-direction: column;
        text-align: center;
    }

    .status-actions {
        flex-direction: column;
        width: 100%;
    }

    .status-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .qr-body {
        flex-direction: column;
        align-items: center;
    }

    .qr-wrapper {
        width: 160px;
        height: 160px;
    }

    .details-grid {
        grid-template-columns: 1fr;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .login-box {
        padding: 30px 20px;
    }
}