/**
 * WA-Connect Custom Styles
 */

/* ======================
   CSS Variables
   ====================== */
:root {
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 60px;
    --sidebar-bg: #212529;
    --sidebar-text: #adb5bd;
    --sidebar-text-active: #ffffff;
    --sidebar-hover-bg: #343a40;
}

/* ======================
   Base Styles
   ====================== */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8f9fa;
}

/* ======================
   Sidebar Styles
   ====================== */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    transition: width 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-header h5,
.sidebar.collapsed .sidebar-nav .nav-link span,
.sidebar.collapsed .sidebar-footer {
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.sidebar-nav .nav-link {
    color: var(--sidebar-text);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover {
    color: var(--sidebar-text-active);
    background-color: var(--sidebar-hover-bg);
}

.sidebar-nav .nav-link.active {
    color: var(--sidebar-text-active);
    background-color: var(--sidebar-hover-bg);
    border-left-color: #25d366;
}

.sidebar-nav .nav-link i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

/* ======================
   Page Content
   ====================== */
#page-content-wrapper {
    min-width: 0;
    background-color: #f8f9fa;
}

/* ======================
   Cards
   ====================== */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border-radius: 0.5rem;
}

.card-header {
    background-color: #ffffff;
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 1.25rem;
}

/* ======================
   Tables
   ====================== */
.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    border-top: none;
}

.table td {
    vertical-align: middle;
}

/* ======================
   Status Badges
   ====================== */
.badge {
    font-weight: 500;
    padding: 0.4em 0.6em;
}

/* ======================
   Buttons
   ====================== */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* ======================
   Forms
   ====================== */
.form-control,
.form-select {
    border-radius: 0.375rem;
    border-color: #ced4da;
    padding: 0.5rem 0.75rem;
}

.form-control:focus,
.form-select:focus {
    border-color: #25d366;
    box-shadow: 0 0 0 0.2rem rgba(37, 211, 102, 0.25);
}

.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.375rem;
}

/* ======================
   Alerts
   ====================== */
.alert {
    border: none;
    border-radius: 0.5rem;
}

/* ======================
   WhatsApp Colors
   ====================== */
.bg-whatsapp {
    background-color: #25d366 !important;
}

.text-whatsapp {
    color: #25d366 !important;
}

.btn-whatsapp {
    background-color: #25d366;
    border-color: #25d366;
    color: #ffffff;
}

.btn-whatsapp:hover {
    background-color: #1da851;
    border-color: #1da851;
    color: #ffffff;
}

/* ======================
   Stats Cards
   ====================== */
.card.bg-primary,
.card.bg-success,
.card.bg-info,
.card.bg-secondary {
    border: none;
}

.card.bg-primary .card-body,
.card.bg-success .card-body,
.card.bg-info .card-body,
.card.bg-secondary .card-body {
    padding: 1.25rem;
}

/* ======================
   QR Code Styles
   ====================== */
.qr-container {
    padding: 2rem;
    background: #ffffff;
    border-radius: 1rem;
    display: inline-block;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.qr-container img {
    max-width: 256px;
    height: auto;
}

/* ======================
   Message Preview
   ====================== */
.message-bubble {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    margin-bottom: 0.5rem;
}

.message-bubble.outgoing {
    background-color: #dcf8c6;
    margin-left: auto;
    border-bottom-right-radius: 0.25rem;
}

.message-bubble.incoming {
    background-color: #ffffff;
    border-bottom-left-radius: 0.25rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ======================
   Loading States
   ====================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ======================
   Responsive
   ====================== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -var(--sidebar-width);
        z-index: 1000;
    }

    .sidebar.show {
        left: 0;
    }

    #page-content-wrapper {
        width: 100%;
    }
}

/* ======================
   Utilities
   ====================== */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cursor-pointer {
    cursor: pointer;
}

.min-h-100 {
    min-height: 100%;
}
