/* Reset e Variáveis */
:root {
    --primary: #25D366;
    --primary-dark: #128C7E;
    --secondary: #34B7F1;
    --dark: #1F2937;
    --darker: #111827;
    --light: #F9FAFB;
    --gray: #6B7280;
    --gray-light: #E5E7EB;
    --white: #FFFFFF;
    --danger: #EF4444;
    --warning: #F59E0B;
    --success: #10B981;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

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

.hidden {
    display: none !important;
}

/* Login Screen */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

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

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

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

.login-header p {
    color: var(--gray);
    font-size: 14px;
}

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

.form-group label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--light);
    border-radius: 8px;
    border: 2px solid var(--gray-light);
    transition: all 0.3s;
}

.form-group label:focus-within {
    border-color: var(--primary);
    background: var(--white);
}

.form-group input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: var(--dark);
}

.form-group i {
    color: var(--gray);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.error-message {
    margin-top: 16px;
    padding: 12px;
    background: #FEE2E2;
    color: var(--danger);
    border-radius: 8px;
    font-size: 14px;
    display: none;
}

.error-message.show {
    display: block;
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--darker);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header i {
    font-size: 32px;
    color: var(--primary);
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 600;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
}

.nav-item.active {
    background: rgba(37, 211, 102, 0.1);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

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

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.user-info i {
    font-size: 32px;
    color: var(--primary);
}

.user-info strong {
    display: block;
    font-size: 14px;
}

.user-info small {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: capitalize;
}

.btn-logout {
    width: 100%;
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header {
    background: var(--white);
    padding: 20px 32px;
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--light);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray);
    transition: all 0.3s;
}

.btn-icon:hover {
    background: var(--gray-light);
    color: var(--dark);
}

/* Conversas Container */
.conversas-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.conversas-list {
    width: 350px;
    background: var(--white);
    border-right: 1px solid var(--gray-light);
    display: flex;
    flex-direction: column;
}

.filters {
    padding: 16px;
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.select-filter,
.search-input {
    padding: 10px 12px;
    border: 1px solid var(--gray-light);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
}

.select-filter:focus,
.search-input:focus {
    border-color: var(--primary);
}

.list-items {
    flex: 1;
    overflow-y: auto;
}

.conversa-item {
    padding: 16px;
    border-bottom: 1px solid var(--gray-light);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.conversa-item:hover {
    background: var(--light);
}

.conversa-item.active {
    background: rgba(37, 211, 102, 0.1);
    border-left: 3px solid var(--primary);
}

.conversa-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 20px;
    font-weight: 600;
    flex-shrink: 0;
}

.conversa-info {
    flex: 1;
    min-width: 0;
}

.conversa-nome {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversa-preview {
    font-size: 12px;
    color: var(--gray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversa-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.conversa-time {
    font-size: 11px;
    color: var(--gray);
}

.conversa-badge {
    background: var(--primary);
    color: var(--white);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--light);
}

.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--gray);
}

.chat-empty i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.chat-active {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    background: var(--white);
    padding: 16px 24px;
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-info i {
    font-size: 40px;
    color: var(--primary);
}

.chat-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.chat-info small {
    font-size: 12px;
    color: var(--gray);
}

.btn-danger {
    padding: 8px 16px;
    background: var(--danger);
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-danger:hover {
    background: #DC2626;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    display: flex;
    gap: 8px;
    max-width: 70%;
    animation: fadeIn 0.3s;
}

.message.sent {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.message-content {
    background: var(--white);
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.message.sent .message-content {
    background: var(--primary);
    color: var(--white);
}

.message-text {
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message-time {
    font-size: 11px;
    color: var(--gray);
    margin-top: 4px;
    text-align: right;
}

.message.sent .message-time {
    color: rgba(255, 255, 255, 0.8);
}

.message-media {
    max-width: 300px;
    border-radius: 8px;
    margin-top: 4px;
}

.chat-input-container {
    background: var(--white);
    padding: 16px 24px;
    border-top: 1px solid var(--gray-light);
    display: flex;
    align-items: center;
    gap: 12px;
}

.message-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--gray-light);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
}

.message-input:focus {
    border-color: var(--primary);
}

.btn-send {
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-send:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* Table */
.table-container {
    padding: 24px;
    background: var(--white);
    margin: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

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

.data-table thead {
    background: var(--light);
}

.data-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: var(--gray);
    border-bottom: 2px solid var(--gray-light);
}

.data-table td {
    padding: 16px 12px;
    border-bottom: 1px solid var(--gray-light);
    font-size: 14px;
}

.data-table tbody tr:hover {
    background: var(--light);
}

/* Config */
.config-container {
    padding: 24px;
}

.config-section {
    background: var(--white);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.config-section h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--dark);
}

.input-full {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-light);
    border-radius: 8px;
    font-size: 14px;
    margin-top: 8px;
    outline: none;
    transition: all 0.3s;
}

.input-full:focus {
    border-color: var(--primary);
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

::-webkit-scrollbar-track {
    background: var(--light);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .conversas-list {
        width: 100%;
    }
    
    .chat-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        background: var(--light);
    }
}

