/* assets/css/style.css */
:root {
    --primary-color: #4A90E2;
    --secondary-color: #50C878;
    --danger-color: #E74C3C;
    --warning-color: #F39C12;
    --dark-color: #2C3E50;
    --light-color: #ECF0F1;
    --sidebar-width: 250px;
    --header-height: 60px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    color: #333;
}

/* Login Page */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

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

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

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

.login-header i {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.login-header h1 {
    font-size: 28px;
    color: var(--dark-color);
    margin-bottom: 5px;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--dark-color);
    color: white;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    transition: transform 0.3s ease-in-out;
    z-index: 999;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header i {
    font-size: 30px;
    margin-bottom: 10px;
    display: block;
}

.sidebar-header h2 {
    font-size: 20px;
    margin-bottom: 5px;
}

.sidebar-header p {
    font-size: 12px;
    color: #a0aec0;
}

.sidebar-nav {
    padding: 20px 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #a0aec0;
    text-decoration: none;
    transition: all 0.3s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    cursor: pointer;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

.sidebar-nav a:active {
    background: rgba(255,255,255,0.2);
}

.sidebar-nav i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 20px;
    min-height: 100vh;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0 20px 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
}

.stat-icon i {
    font-size: 24px;
    color: white;
}

.stat-icon.blue { background: var(--primary-color); }
.stat-icon.green { background: var(--secondary-color); }
.stat-icon.orange { background: var(--warning-color); }
.stat-icon.purple { background: #8B5CF6; }

.stat-info h3 {
    font-size: 24px;
    margin-bottom: 5px;
}

.stat-info p {
    color: #666;
    font-size: 14px;
}

/* Cards */
.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 30px;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.card-header h3 {
    font-size: 18px;
}

.card-body {
    padding: 20px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.input-group {
    position: relative;
}

.input-group i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.input-group input {
    width: 100%;
    padding: 10px 10px 10px 35px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.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 textarea {
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

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

.btn-primary:hover {
    background: #357abd;
}

.btn-success {
    background: var(--secondary-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-block {
    width: 100%;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
}

/* Tabelas */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
}

.data-table tr:hover {
    background: #f8f9fa;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge i {
    font-size: 8px;
}

.status-online {
    background: #d1fae5;
    color: #065f46;
}

.status-online i {
    color: #10b981;
}

.status-offline {
    background: #fee2e2;
    color: #991b1b;
}

.status-offline i {
    color: #ef4444;
}

.status-busy {
    background: #fef3c7;
    color: #92400e;
}

.status-busy i {
    color: #f59e0b;
}

.status-sent {
    background: #dbeafe;
    color: #1e40af;
}

.status-sent i {
    color: #3b82f6;
}

.status-failed {
    background: #fee2e2;
    color: #991b1b;
}

.status-failed i {
    color: #ef4444;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-pending i {
    color: #f59e0b;
}

.status-delivered {
    background: #d1fae5;
    color: #065f46;
}

.status-delivered i {
    color: #10b981;
}

/* Indicadores de Sinal */
.signal-indicator {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 20px;
}

.signal-bar {
    width: 4px;
    background: #e5e7eb;
    border-radius: 2px;
}

.signal-bar.active {
    background: #10b981;
}

.signal-bar:nth-child(1) { height: 4px; }
.signal-bar:nth-child(2) { height: 8px; }
.signal-bar:nth-child(3) { height: 12px; }
.signal-bar:nth-child(4) { height: 16px; }
.signal-bar:nth-child(5) { height: 20px; }

/* Indicador de Bateria */
.battery-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Badges de Grupo */
.group-badge {
    display: inline-block;
    padding: 4px 8px;
    background: #e0e7ff;
    color: #3730a3;
    border-radius: 4px;
    font-size: 12px;
}

.plan-badge {
    display: inline-block;
    padding: 4px 8px;
    background: #4A90E2;
    color: white;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.credits-badge {
    display: inline-block;
    padding: 4px 8px;
    background: #f59e0b;
    color: white;
    border-radius: 4px;
    font-size: 12px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: auto;
}

.user-plan {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 20px 0;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--dark-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.3s;
    align-items: center;
    justify-content: center;
}

.mobile-menu-toggle:hover {
    background: #34495e;
    transform: scale(1.05);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1100;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.modal-body {
    padding: 20px;
}

/* Action Bar */
.action-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* Filters */
.filters-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filters-row .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 150px;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.page-link {
    display: inline-block;
    padding: 8px 12px;
    background: #f3f4f6;
    color: #374151;
    text-decoration: none;
    border-radius: 5px;
    transition: all 0.3s;
}

.page-link:hover {
    background: #e5e7eb;
}

.page-link.active {
    background: var(--primary-color);
    color: white;
}

/* Settings Grid */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

/* API Key Display */
.api-key-display {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.api-key-display code {
    flex: 1;
    background: #f3f4f6;
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
    word-break: break-all;
}

.api-docs {
    margin-top: 20px;
    padding: 15px;
    background: #f9fafb;
    border-radius: 5px;
}

.api-docs pre {
    background: #1f2937;
    color: #e5e7eb;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    margin-top: 10px;
    font-size: 14px;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 5px;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateX(120%);
    transition: transform 0.3s;
    z-index: 2000;
    max-width: 90vw;
    word-break: break-word;
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    background: #10b981;
}

.notification-error {
    background: #ef4444;
}

/* Message Preview */
.message-preview {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Text Utilities */
.text-center {
    text-align: center;
}

.text-muted {
    color: #6b7280;
}

.text-right {
    text-align: right;
}

/* Responsive */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }
    
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        max-width: 85vw;
        box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding-top: 70px;
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .sidebar-nav a {
        padding: 15px 20px;
        min-height: 50px;
        font-size: 16px;
    }
    
    .sidebar-header {
        padding: 25px 20px;
    }
    
    .sidebar-footer {
        position: relative;
        bottom: auto;
        margin-top: 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .filters-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .filters-row .form-group {
        width: 100%;
    }
    
    .action-bar {
        flex-direction: column;
    }
    
    .action-bar .btn {
        width: 100%;
        justify-content: center;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px;
    }
    
    .top-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .notification {
        top: auto;
        bottom: 20px;
        right: 10px;
        left: 10px;
        transform: translateY(200%);
    }
    
    .notification.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 250px;
    }
    
    .sidebar-nav a {
        padding: 12px 15px;
        font-size: 15px;
        min-height: 45px;
    }
    
    .mobile-menu-toggle {
        top: 10px;
        left: 10px;
        width: 35px;
        height: 35px;
    }
    
    .main-content {
        padding-top: 60px;
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .card-header,
    .card-body {
        padding: 15px;
    }
    
    .btn {
        padding: 8px 15px;
        font-size: 13px;
    }
    
    .stats-grid {
        gap: 10px;
    }
}

@media (max-width: 320px) {
    .sidebar {
        width: 200px;
    }
    
    .sidebar-nav a {
        padding: 10px 12px;
        font-size: 14px;
        min-height: 40px;
    }
    
    .main-content {
        padding-top: 55px;
        padding-left: 8px;
        padding-right: 8px;
    }
}