:root {
    --primary: #25D366;
    --primary-dark: #128C7E;
    --secondary: #075E54;
    --background: #f0f2f5;
    --card-bg: rgba(255, 255, 255, 0.85);
    --text-main: #111b21;
    --text-muted: #667781;
    --border: rgba(0, 0, 0, 0.1);
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    --glass-border: rgba(255, 255, 255, 0.4);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background);
    background-image: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
}

/* Glassmorphism Container */
.container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 30px;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

nav {
    display: flex;
    align-items: center;
}

nav a {
    text-decoration: none;
    color: var(--text-main);
    margin-left: 20px;
    font-weight: 500;
    transition: color 0.3s ease;
}

nav a:hover, nav a.active {
    color: var(--primary-dark);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--secondary);
    padding: 5px;
}

/* Typography */
h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--text-main);
}

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

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-main);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 10px;
    background: rgba(255,255,255,0.9);
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.2);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.btn-secondary {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    border-radius: 10px;
    overflow: hidden;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: rgba(0,0,0,0.02);
    font-weight: 600;
    color: var(--text-muted);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background: rgba(0,0,0,0.01);
}

/* Layout Grids */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.stat-card {
    text-align: center;
    padding: 30px;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary-dark);
    margin: 10px 0;
}

/* WhatsApp Message Preview UI */
.wa-preview-container {
    background: #efeae2;
    padding: 20px;
    border-radius: 15px;
    position: relative;
    max-width: 350px;
    margin: 0 auto;
    background-image: url('data:image/svg+xml;utf8,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><g fill="%23dcd2c6" fill-opacity="0.4" fill-rule="evenodd"><path d="M11.23 18.06l-4.14-4.13a1 1 0 0 1 1.42-1.42l3.43 3.44L23.49 4.4a1 1 0 1 1 1.42 1.42l-12.26 12.24a1 1 0 0 1-1.42 0z"/></g></svg>');
}

.wa-bubble {
    background: white;
    border-radius: 0 8px 8px 8px;
    padding: 10px 15px;
    position: relative;
    box-shadow: 0 1px 0.5px rgba(11,20,26,.13);
    font-size: 14.2px;
    color: #111b21;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.wa-bubble::before {
    content: "";
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 8px 8px 0;
    border-color: transparent white transparent transparent;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    header {
        flex-wrap: wrap;
    }
    
    .container {
        margin: 10px;
        padding: 15px;
        border-radius: 10px;
    }
    
    .grid-2 {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    nav {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        margin-top: 15px;
    }
    
    nav.active {
        display: flex;
    }
    
    nav a {
        margin: 5px 0;
        padding: 12px;
        background: rgba(0,0,0,0.03);
        border-radius: 8px;
        text-align: center;
    }
    
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    /* Responsive metric cards on reports page */
    .grid-2[style*="repeat(4"] {
        grid-template-columns: 1fr 1fr !important;
    }
}

/* Floating Inbox Button */
.floating-inbox-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--primary);
    color: white;
    padding: 15px 25px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
    text-decoration: none;
    z-index: 1000;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}
.floating-inbox-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
    color: white;
}

/* Navigation Dropdowns */
.nav-dropdown {
    position: relative;
    display: inline-block;
    margin-left: 20px;
}

.dropdown-btn {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    padding: 5px 0;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.dropdown-btn:hover {
    color: var(--primary-dark);
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #fff;
    min-width: 200px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border-radius: 8px;
    z-index: 1000;
    top: 100%;
    left: 0;
    border: 1px solid var(--border);
    padding: 8px 0;
}

.dropdown-content a {
    color: var(--text-main);
    padding: 10px 16px;
    text-decoration: none;
    display: block;
    margin-left: 0 !important;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
    text-align: left;
}

.dropdown-content a:hover {
    background-color: #f3f4f6;
    color: var(--primary-dark);
}

.nav-dropdown:hover .dropdown-content {
    display: block;
}

@media (max-width: 768px) {
    .nav-dropdown {
        margin-left: 0 !important;
        margin-bottom: 8px;
        width: 100%;
    }
    .dropdown-btn {
        width: 100%;
        padding: 12px;
        background: rgba(0,0,0,0.03);
        border-radius: 8px;
        justify-content: center;
    }
    .dropdown-content {
        position: static;
        box-shadow: none;
        border: none;
        background: rgba(0,0,0,0.01);
        padding-left: 0;
        width: 100%;
    }
    .dropdown-content a {
        text-align: center;
    }
}

/* Responsive overrides for Inbox and Settings */
@media (max-width: 768px) {
    /* General Card padding reduction for mobile */
    .card {
        padding: 15px !important;
    }

    /* Tab Headers for settings */
    .tab-headers {
        flex-wrap: wrap !important;
        gap: 5px !important;
    }
    
    .tab-header {
        padding: 8px 12px !important;
        font-size: 13px !important;
        flex: 1 1 auto;
        text-align: center;
        background: rgba(0,0,0,0.03);
        border-radius: 6px;
    }

    .tab-header.active {
        background: rgba(37, 211, 102, 0.1) !important;
        border-bottom: 3px solid var(--primary) !important;
    }

    /* Inbox Container Mobile Styling */
    .inbox-container {
        position: relative;
        height: 75vh !important;
    }

    .chat-list {
        width: 100% !important;
        flex-shrink: 0;
        display: flex !important;
    }

    .chat-window {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 100;
        display: none !important;
    }

    /* Show chat window / hide chat list when active */
    .inbox-container.mobile-chat-active .chat-list {
        display: none !important;
    }

    .inbox-container.mobile-chat-active .chat-window {
        display: flex !important;
    }

    /* Mobile Back Button */
    #mobile-back-btn {
        display: inline-flex !important;
    }

    /* Hide non-critical labels to save space */
    .hide-mobile {
        display: none !important;
    }

    /* CRM side panel on mobile */
    .crm-side-panel {
        position: absolute;
        top: 0;
        right: 0;
        width: 100% !important;
        height: 100%;
        z-index: 200;
        background: #fff;
    }

    /* Chat bubble width on mobile */
    .message {
        max-width: 85% !important;
    }
}

