/**
 * Custom Styles
 * WhatsApp CRM & Automation Admin Panel
 */

/* Color Variables — Eleganza brand teal (sampled from the logo wordmark) */
:root {
    --primary-color: #1B4E5F;
    --primary-dark:  #0E3340;
    --primary-rgb:   27, 78, 95;
    --sidebar-width: 250px;
    --navbar-height: 60px;
}

/* Global Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f8f9fa;
}

/* Gradient Background */
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%) !important;
}

/* Grid Layout */
.grid-container {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    min-height: calc(100vh - var(--navbar-height));
    position: sticky;
    top: 0;
    /* No float or flex properties needed */
}

.sidebar .nav-link {
    color: #adb5bd;
    padding: 12px 20px;
    font-size: 14px;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.sidebar .nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-left-color: var(--primary-color);
}

.sidebar .nav-link i {
    width: 20px;
}

.sidebar .nav-header {
    padding: 20px 20px 10px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #6c757d;
    font-weight: 600;
}

/* Main Content */
.main-content {
    /* Width and float are no longer needed, Grid handles it */
    min-height: calc(100vh - var(--navbar-height));
    background: #f8f9fa;
    overflow-x: auto;
    /* Keep this to handle internal overflow */
}

/* Statistics Cards */
.stat-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

/* Avatar Placeholder */
.avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
}

/* Card Styling */
.card {
    border-radius: 10px;
    margin-bottom: 20px;
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 15px 20px;
}

.card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

/* Buttons */
.btn {
    border-radius: 8px;
    padding: 8px 20px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(var(--primary-rgb), 0.4);
}

/* Form Elements */
.form-control,
.form-select {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 10px 15px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb), 0.25);
}

.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 8px;
}

/* Badges */
.badge {
    padding: 6px 12px;
    font-weight: 500;
    border-radius: 6px;
}

/* Alerts */
.alert {
    border-radius: 10px;
    border: none;
}

/* DataTables Styling */
.dataTables_wrapper .dataTables_length select {
    border-radius: 6px;
    border: 1px solid #dee2e6;
    min-width: 10px !important;
    /* Force width */
    padding-right: 30px !important;
    /* Ensure space for arrow */
    background-position: right 0.75rem center;
    /* standard bootstrap position */
}

.dataTables_wrapper .dataTables_filter input {
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

table.dataTable thead th {
    background: #f8f9fa;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
}

table.dataTable tbody tr:hover {
    background: #f8f9fa;
}

/* Modal Styling */
.modal-content {
    border-radius: 12px;
    border: none;
}

.modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: #f8f9fa;
}

/* File Upload Area */
.upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(var(--primary-rgb), 0.05);
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(var(--primary-rgb), 0.1);
}

/* Chat Styles */
.chat-list {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.chat-message {
    padding: 12px 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    max-width: 70%;
}

.chat-message.outgoing {
    background: #dcf8c6;
    margin-left: auto;
}

.chat-message.incoming {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-border-lg {
    width: 3rem;
    height: 3rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        min-height: auto;
        position: relative;
    }

    .main-content {
        min-height: auto;
    }

    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-sm {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08) !important;
}

.shadow {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1) !important;
}

.shadow-lg {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}