/* assets/css/style.css - Premium Modern Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Palette */
    --primary-color: #3182ce; /* Brand Blue */
    --primary-hover: #2b6cb0;
    --bg-color: #0f172a; /* Deep Slate (Dark Mode) */
    --surface-color: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --error-color: #ef4444;
    --success-color: #10b981;
    --input-bg: #0f172a;

    /* Spacing & Radius */
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Authentication Layout (Login) */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: radial-gradient(circle at top left, #1e293b, var(--bg-color));
}

.auth-card {
    background: var(--surface-color);
    width: 100%;
    max-width: 420px;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    animation: slideUp 0.5s ease forwards;
}

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

.auth-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    font-size: 15px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 14px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   Standard Adaptive Layout
   ========================================= */
.app-container {
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--surface-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transition: width 0.3s ease;
    overflow-x: hidden;
    overflow-y: auto;
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.sidebar-logo img.logo-full {
    width: 40px;
    height: auto;
    display: none;
}

.sidebar-logo img.logo-icon {
    width: 140px;
    height: auto;
    display: block;
}

.sidebar.collapsed .sidebar-logo img.logo-full {
    display: block;
}

.sidebar.collapsed .sidebar-logo img.logo-icon {
    display: none;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar.collapsed .sidebar-toggle {
    margin: 0 auto;
}

.sidebar.collapsed .sidebar-header {
    padding: 24px 0;
    justify-content: center;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
    flex: 1;
}

.sidebar-menu li {
    margin-bottom: 4px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: 0.2s;
}

.sidebar-menu a span {
    transition: opacity 0.3s;
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-menu a span {
    display: none;
}

.sidebar.collapsed .sidebar-menu a {
    justify-content: center;
    padding: 12px 0;
}

.sidebar.collapsed .sidebar-menu a svg {
    margin-right: 0;
}

.sidebar-menu a:hover, .sidebar-menu a.active {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
}

.sidebar-menu a svg {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* Main Content Area */
.main-wrapper {
    margin-left: 260px;
    width: auto;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    display: flex;
    flex-direction: column;
}

.main-wrapper.sidebar-collapsed {
    margin-left: 80px;
}


/* Top Header */
.top-header {
    height: 70px;
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.header-title h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    text-align: right;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
}

.user-role {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.logout-btn {
    padding: 8px 16px;
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
}

.logout-btn:hover {
    background-color: var(--error-color);
    color: white;
}

/* Content Area */
.content-area {
    padding: 30px;
    flex: 1;
}

/* Dashboard Cards Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px -10px rgba(0, 0, 0, 0.5);
    border-color: var(--primary-color);
}

.stat-info h3 {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-info .value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.primary {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.stat-icon.success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.stat-icon.warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

/* Sections */
.section-header {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

/* =========================================
   Data Tables & Badges
   ========================================= */

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.data-table th, .data-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    font-size: 14px;
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.badge-lead {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.badge-prospect {
    background-color: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.badge-converted {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.badge-closed {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

/* Action Buttons for tables */
.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    border: none;
    transition: var(--transition);
}

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

.btn-secondary:hover {
    border-color: var(--text-secondary);
    background-color: rgba(255, 255, 255, 0.05);
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

.btn-danger:hover {
    background-color: var(--error-color);
    color: white;
}

.actions-group {
    display: flex;
    gap: 8px;
}

/* =========================================
   Chatbot Widget Elements
   ========================================= */

.chatbot-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.5);
    cursor: pointer;
    z-index: 999;
    transition: var(--transition);
}

.chatbot-btn:hover {
    transform: scale(1.1);
}

.chatbot-btn svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    height: 450px;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    z-index: 999;
    transform: scale(0);
    transform-origin: bottom right;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-window.open {
    transform: scale(1);
}

.chat-header {
    background-color: var(--primary-color);
    color: white;
    padding: 16px 20px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.close-chat {
    cursor: pointer;
    background: none;
    border: none;
    color: white;
}

.close-chat svg {
    width: 20px;
    height: 20px;
}

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

.chat-msg {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
}

.msg-bot {
    align-self: flex-start;
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.msg-user {
    align-self: flex-end;
    background-color: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 14px;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

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

.chat-send:hover {
    background-color: var(--primary-hover);
}



/* =========================================
   Intl-Tel-Input Dark Mode & UI Overrides
   ========================================= */
.iti { 
    width: 100%; 
    display: block; 
}
.iti__country-list {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-color);
    box-shadow: var(--shadow-lg);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
}
.iti__country.iti__highlight, .iti__country:hover {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}
.iti__selected-flag {
    background-color: transparent !important;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}
.iti__selected-flag:hover, .iti__selected-flag:focus {
    background-color: rgba(255,255,255,0.05) !important;
}
.iti input, .iti input[type=text], .iti input[type=tel] {
    background-color: var(--surface-color) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    height: 44px !important;
    transition: all 0.3s ease !important;
}
.iti input:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
}
.iti__search-input {
    background-color: var(--bg-color) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-sm) !important;
    padding: 8px 12px !important;
    margin: 8px !important;
    width: calc(100% - 16px) !important;
}
