/* WebWhat CRM - Professional SaaS Styles */
:root {
    --primary: #25D366;
    --primary-dark: #128C7E;
    --primary-light: #DCF8C6;
    --secondary: #075E54;
    --sidebar-bg: #1a1d21;
    --sidebar-hover: #2a2d35;
    --sidebar-active: #25D366;
    --body-bg: #f5f7fa;
    --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --border-color: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--body-bg);
    font-size: 14px;
    color: var(--text-primary);
}

/* Sidebar */
.sidebar {
    width: 260px;
    min-height: 100vh;
    background: var(--sidebar-bg);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1050;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
    color: #fff;
    text-decoration: none;
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand i {
    color: var(--primary);
    font-size: 1.5rem;
}

.sidebar-nav {
    list-style: none;
    padding: 15px 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav .nav-item {
    margin: 2px 12px;
}

.sidebar-nav .nav-link {
    color: rgba(255, 255, 255, 0.7);
    padding: 10px 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 13.5px;
    font-weight: 500;
}

.sidebar-nav .nav-link:hover {
    color: #fff;
    background: var(--sidebar-hover);
}

.sidebar-nav .nav-link.active {
    color: #fff;
    background: var(--primary-dark);
}

.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 15px 12px;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar i {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.7);
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

.user-role {
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
}

/* Page Content */
#page-content-wrapper {
    margin-left: 260px;
    width: calc(100% - 260px);
    min-height: 100vh;
    transition: all 0.3s ease;
}

.top-navbar {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 10px 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.top-navbar .btn-link {
    color: var(--text-primary);
    text-decoration: none;
}

.page-content {
    padding: 25px;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.page-header .breadcrumb {
    margin: 5px 0 0;
    font-size: 12px;
}

/* Cards */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 10px 0 5px;
}

.stat-card .stat-label {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

.stat-card .stat-change {
    font-size: 12px;
    font-weight: 600;
}

/* Data Cards */
.data-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}

.data-card .card-header {
    background: none;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.data-card .card-header h5 {
    margin: 0;
    font-weight: 600;
    font-size: 1rem;
}

.data-card .card-body {
    padding: 20px;
}

/* Tables */
.table-custom {
    margin: 0;
}

.table-custom thead th {
    background: #f8f9fa;
    border-bottom: 2px solid var(--border-color);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 12px 15px;
}

.table-custom tbody td {
    padding: 12px 15px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

.table-custom tbody tr:hover {
    background: #f8f9fa;
}

/* Badges */
.badge-status {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

/* Chat Styles */
.chat-container {
    display: flex;
    height: calc(100vh - 130px);
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.chat-sidebar {
    width: 350px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.chat-sidebar-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    gap: 12px;
}

.chat-item:hover,
.chat-item.active {
    background: #f0faf4;
}

.chat-item .chat-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--primary-dark);
    flex-shrink: 0;
}

.chat-item .chat-info {
    flex: 1;
    min-width: 0;
}

.chat-item .chat-name {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
}

.chat-item .chat-preview {
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item .chat-time {
    font-size: 11px;
    color: var(--text-muted);
}

.chat-item .unread-badge {
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
}

/* Chat Main Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #e5ddd5;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d4ccc4' fill-opacity='0.4'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.message-bubble {
    max-width: 65%;
    padding: 8px 14px;
    border-radius: 8px;
    margin-bottom: 8px;
    position: relative;
    word-wrap: break-word;
}

.message-bubble.outbound {
    background: var(--primary-light);
    margin-left: auto;
    border-bottom-right-radius: 2px;
}

.message-bubble.inbound {
    background: #fff;
    border-bottom-left-radius: 2px;
}

.message-bubble .message-text {
    font-size: 14px;
    line-height: 1.5;
}

.message-bubble .message-time {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
    margin-top: 4px;
}

.message-bubble .message-status {
    color: #53bdeb;
}

/* Chat Input */
.chat-input {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    align-items: center;
    background: #fff;
}

.chat-input .form-control {
    border-radius: 20px;
    padding: 10px 20px;
    border: 1px solid var(--border-color);
}

.chat-input .btn-send {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Forms */
.form-floating label {
    font-size: 14px;
}

/* Buttons */
.btn-whatsapp {
    background: var(--primary);
    color: #fff;
    border: none;
}

.btn-whatsapp:hover {
    background: var(--primary-dark);
    color: #fff;
}

/* Notification dropdown */
.notification-dropdown {
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
}

/* Auth Pages */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary-dark) 100%);
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-card .auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-card .auth-logo i {
    font-size: 3rem;
    color: var(--primary);
}

.auth-card .auth-logo h2 {
    font-weight: 700;
    margin-top: 10px;
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    #page-content-wrapper {
        margin-left: 0;
        width: 100%;
    }
    
    .chat-sidebar {
        width: 100%;
    }
    
    .chat-main {
        display: none;
    }
    
    .chat-main.active {
        display: flex;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.empty-state h4 {
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--text-muted);
}

/* Tag styles */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    background: #e9ecef;
    color: var(--text-secondary);
    margin: 2px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}
