/* ============================================================
   GHL SaaS Platform - Main Stylesheet
   ============================================================ */

/* CSS Variables (Brand Colors - Own Identity) */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #60a5fa;
    --secondary-color: #7c3aed;
    --secondary-dark: #6d28d9;
    --success-color: #10b981;
    --success-light: #d1fae5;
    --warning-color: #f59e0b;
    --warning-light: #fef3c7;
    --danger-color: #ef4444;
    --danger-light: #fee2e2;
    --info-color: #06b6d4;
    --info-light: #cffafe;

    --bg-color: #f1f5f9;
    --bg-white: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: #1e293b;
    --bg-header: #ffffff;

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-light: #cbd5e1;
    --text-white: #ffffff;

    --border-color: #e2e8f0;
    --border-light: #f1f5f9;

    --sidebar-width: 260px;
    --header-height: 64px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04);

    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --transition: all 0.2s ease;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* ============================================================
   LAYOUT: APP SHELL
   ============================================================ */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-shell .sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-light);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow-y: auto;
}

.app-shell .main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-shell .main-content {
    flex: 1;
    padding: 24px;
    margin-top: var(--header-height);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar-brand {
    padding: 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand .brand-logo {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
}

.sidebar-brand .brand-text {
    color: var(--text-white);
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.2;
}

.sidebar-brand .brand-subtext {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.sidebar-section {
    padding: 8px 20px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-top: 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-light);
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-white);
    text-decoration: none;
}

.sidebar-link.active {
    background: var(--bg-sidebar-hover);
    color: var(--text-white);
    border-left-color: var(--primary-color);
}

.sidebar-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-link .badge {
    margin-left: auto;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
}

/* ============================================================
   SIDEBAR OVERLAY (mobile)
   ============================================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 998;
}

@media (max-width: 768px) {
    .sidebar-overlay.active {
        display: block;
    }
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
    height: var(--header-height);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-left .menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
}

.header-search {
    position: relative;
    width: 320px;
}

.header-search input {
    width: 100%;
    padding: 8px 16px 8px 40px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-color);
    font-size: 0.9rem;
    transition: var(--transition);
}

.header-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-white);
}

.header-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.header-btn:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

.header-btn .notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--danger-color);
    border-radius: 50%;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.card-header h5 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
}

/* ============================================================
   KPI CARDS
   ============================================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
}

.kpi-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.kpi-icon.blue { background: #dbeafe; color: var(--primary-color); }
.kpi-icon.green { background: var(--success-light); color: var(--success-color); }
.kpi-icon.yellow { background: var(--warning-light); color: var(--warning-color); }
.kpi-icon.red { background: var(--danger-light); color: var(--danger-color); }
.kpi-icon.purple { background: #ede9fe; color: var(--secondary-color); }
.kpi-icon.cyan { background: var(--info-light); color: var(--info-color); }

.kpi-info {
    flex: 1;
}

.kpi-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.kpi-change {
    font-size: 0.75rem;
    margin-top: 4px;
}

.kpi-change.positive { color: var(--success-color); }
.kpi-change.negative { color: var(--danger-color); }

/* ============================================================
   TABLES
   ============================================================ */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

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

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

.table td {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.table tbody tr:hover {
    background: var(--bg-color);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success { background: var(--success-light); color: var(--success-color); }
.badge-warning { background: var(--warning-light); color: var(--warning-color); }
.badge-danger { background: var(--danger-light); color: var(--danger-color); }
.badge-info { background: var(--info-light); color: var(--info-color); }
.badge-secondary { background: #f1f5f9; color: var(--text-secondary); }
.badge-primary { background: #dbeafe; color: var(--primary-color); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    text-decoration: none;
}

.btn i {
    font-size: 1rem;
}

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

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

.btn-secondary {
    background: var(--bg-white);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-color);
}

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

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

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

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

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--bg-white);
    transition: var(--transition);
}

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

.form-control::placeholder {
    color: var(--text-muted);
}

.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--bg-white);
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

.modal-lg {
    max-width: 800px;
}

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

.modal-header h5 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ============================================================
   TABS
   ============================================================ */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
}

.tab-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
}

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

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ============================================================
   DROPDOWNS
   ============================================================ */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    min-width: 200px;
    z-index: 100;
    display: none;
    padding: 8px 0;
}

.dropdown-menu.active {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background: var(--bg-color);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 14px 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
    border-left: 4px solid var(--primary-color);
}

.toast.success { border-left-color: var(--success-color); }
.toast.error { border-left-color: var(--danger-color); }
.toast.warning { border-left-color: var(--warning-color); }

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ============================================================
   LOADING / SKELETON
   ============================================================ */
.skeleton {
    background: linear-gradient(90deg, var(--border-color) 25%, var(--border-light) 50%, var(--border-color) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 20px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    color: var(--text-light);
}

.empty-state h5 {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ============================================================
   CONFIRMATION DIALOG
   ============================================================ */
.confirm-dialog .modal-body {
    text-align: center;
    padding: 32px 24px;
}

.confirm-dialog .confirm-icon {
    font-size: 3rem;
    color: var(--warning-color);
    margin-bottom: 16px;
}

.confirm-dialog .confirm-message {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 20px;
}

.login-box {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-xl);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .logo-icon {
    width: 64px;
    height: 64px;
    background: var(--primary-color);
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.login-logo h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .form-label {
    font-weight: 600;
    margin-bottom: 8px;
}

.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
}

.login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 0.85rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
}

.forgot-link {
    color: var(--primary-color);
    font-weight: 500;
}

.login-btn {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.login-error {
    background: var(--danger-light);
    color: var(--danger-color);
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: none;
    align-items: center;
    gap: 8px;
}

.login-error.active {
    display: flex;
}

/* ============================================================
   GRIDS & LAYOUTS
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.p-3 { padding: 24px; }

/* ============================================================
   PLANS CARDS
   ============================================================ */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.plan-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 24px;
    text-align: center;
    transition: var(--transition);
    position: relative;
}

.plan-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.plan-card.popular {
    border: 2px solid var(--primary-color);
}

.plan-card.popular::before {
    content: 'POPULAR';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.plan-name {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.plan-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.plan-price span {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-secondary);
}

.plan-features {
    list-style: none;
    text-align: left;
    margin: 20px 0;
}

.plan-features li {
    padding: 6px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.plan-features li i {
    color: var(--success-color);
    font-size: 0.8rem;
}

/* ============================================================
   CHAT / CONVERSATIONS
   ============================================================ */
.chat-layout {
    display: grid;
    grid-template-columns: 320px 1fr 300px;
    height: calc(100vh - var(--header-height) - 48px);
    gap: 1px;
    background: var(--border-color);
}

.chat-list {
    background: var(--bg-white);
    overflow-y: auto;
}

.chat-main {
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
}

.chat-contact {
    background: var(--bg-white);
    overflow-y: auto;
    padding: 20px;
}

.chat-message {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.chat-message .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.chat-message .message-bubble {
    background: var(--bg-white);
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    max-width: 70%;
}

.chat-message .message-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.chat-composer {
    padding: 16px;
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    align-items: center;
}

.chat-composer textarea {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    resize: none;
    font-size: 0.9rem;
    min-height: 44px;
    max-height: 120px;
}

/* ============================================================
   PROVIDER CARDS
   ============================================================ */
.provider-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.provider-card:hover {
    box-shadow: var(--shadow-md);
}

.provider-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.provider-info {
    flex: 1;
}

.provider-info h5 {
    font-weight: 600;
    margin-bottom: 4px;
}

.provider-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ============================================================
   STATS / ACTIVITY
   ============================================================ */
.activity-list {
    list-style: none;
}

.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
    font-size: 0.9rem;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    padding: 20px 0;
}

.page-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.page-btn:hover {
    background: var(--bg-color);
}

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

/* ============================================================
   TOGGLE SWITCH
   ============================================================ */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    background: var(--border-color);
    border-radius: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.toggle-switch.active {
    background: var(--success-color);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-switch.active::after {
    left: 25px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .plans-grid { grid-template-columns: repeat(2, 1fr); }
    .chat-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 260px;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        width: 230px;
    }

    .app-shell .main-wrapper {
        margin-left: 0;
    }

    .header {
        left: 0;
    }

    .header-left .menu-toggle {
        display: block !important;
    }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .plans-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-search {
        display: none;
    }

    .table {
        font-size: 0.8rem;
    }

    .table th, .table td {
        padding: 8px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal {
        width: 95%;
        margin: 10px;
    }
}

@media (max-width: 480px) {
    .app-shell .main-content {
        padding: 16px;
    }

    .kpi-card {
        flex-direction: column;
        gap: 12px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .btn-group {
        flex-wrap: wrap;
    }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .sidebar, .header, .btn, .modal {
        display: none !important;
    }

    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
}
