/* ============================================
   MODERN LEAD MANAGEMENT PRO - ENHANCED CSS
   Version 3.1 - Complete with Modal Fixes
   ============================================ */

/* ===== GLOBAL RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "kern" 1;
    font-kerning: normal;
}

html {
    height: 100%;
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    color: #1F2937;
    background-color: #f9fafb;
    line-height: 1.6;
    font-weight: 450;
    letter-spacing: 0.01em;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Fix for cloud status bar */
body {
    padding-top: 32px !important;
}

/* ===== CLOUD STATUS BAR ===== */
#cloud-status-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #1f2937;
    color: white;
    font-size: 14px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
    height: 32px;
}

#cloud-status-bar .flex {
    display: flex;
    align-items: center;
    gap: 8px;
}

#cloud-status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.cloud-connected {
    background: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    animation: pulse-glow 2s infinite;
}

.cloud-disconnected {
    background: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.cloud-syncing {
    background: #f59e0b;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
    animation: pulse-glow 1.5s infinite;
}

#cloud-status-text {
    font-weight: 500;
}

#last-sync-time, #user-display {
    font-size: 12px;
    color: #9ca3af;
}

/* ===== MAIN LAYOUT ===== */
.flex.h-screen {
    height: calc(100vh - 32px) !important;
    min-height: calc(100vh - 32px);
}

/* ===== SIDEBAR ===== */
.w-72.bg-gradient-to-br {
    width: 18rem;
    position: relative;
    z-index: 10;
}

/* ===== UTILITY CLASSES ===== */
.hide {
    display: none !important;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

/* ===== MODAL FIXES ===== */
.modal-backdrop {
    backdrop-filter: blur(8px);
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
}

.modal-backdrop > div {
    max-height: 90vh;
    overflow-y: auto;
    width: 100%;
    max-width: 90vw;
}

/* Specific fix for mapping modal */
#mapping-modal .bg-white {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

#mapping-modal .p-6:first-child {
    position: sticky;
    top: 0;
    background: linear-gradient(to right, #4f46e5, #7c3aed);
    z-index: 10;
    color: white;
    flex-shrink: 0;
}

#mapping-modal .p-6:not(:first-child):not(:last-child) {
    flex: 1;
    overflow-y: auto;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

#mapping-modal .p-6:last-child {
    position: sticky;
    bottom: 0;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

/* Mapping fields container */
#mapping-fields {
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 0.5rem;
}

#mapping-fields::-webkit-scrollbar {
    width: 6px;
}

#mapping-fields::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#mapping-fields::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#mapping-fields::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Mapping field rows */
#mapping-fields .grid {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    align-items: center;
}

#mapping-fields .grid:last-child {
    border-bottom: none;
}

#mapping-fields .grid:hover {
    background-color: #f9fafb;
}

/* ===== STATUS BADGES ===== */
.status-active {
    background: linear-gradient(135deg, #D1FAE5 0%, #A7F3D0 100%);
    color: #065F46;
    border: 1px solid #6EE7B7;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-block;
    white-space: nowrap;
}

.status-busy {
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    color: #92400E;
    border: 1px solid #FCD34D;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-block;
    white-space: nowrap;
}

.status-away {
    background: linear-gradient(135deg, #E5E7EB 0%, #D1D5DB 100%);
    color: #374151;
    border: 1px solid #9CA3AF;
    box-shadow: 0 2px 4px rgba(156, 163, 175, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-block;
    white-space: nowrap;
}

.status-inactive {
    background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
    color: #991B1B;
    border: 1px solid #FCA5A5;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-block;
    white-space: nowrap;
}

/* ===== STATUS BACKGROUNDS ===== */
.status-active-bg {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-block;
    white-space: nowrap;
}

.status-inactive-bg {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-block;
    white-space: nowrap;
}

.status-busy-bg {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-block;
    white-space: nowrap;
}

.status-away-bg {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-block;
    white-space: nowrap;
}

/* ===== ROLE BADGES ===== */
.role-admin {
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    display: inline-block;
    white-space: nowrap;
}

.role-manager {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    display: inline-block;
    white-space: nowrap;
}

.role-agent {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    display: inline-block;
    white-space: nowrap;
}

/* ===== ROLE BACKGROUND BADGES ===== */
.role-badge {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}

.role-admin-bg {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

.role-agent-bg {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.role-manager-bg {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

/* ===== CALL STATUS CLASSES ===== */
.call-status-not-called {
    background: linear-gradient(135deg, #F9FAFB 0%, #F3F4F6 100%);
    color: #374151;
    border: 1px solid #E5E7EB;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-block;
    white-space: nowrap;
}

.call-status-connected {
    background: linear-gradient(135deg, #D1FAE5 0%, #A7F3D0 100%);
    color: #065F46;
    border: 1px solid #6EE7B7;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-block;
    white-space: nowrap;
}

.call-status-voicemail {
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    color: #92400E;
    border: 1px solid #FCD34D;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-block;
    white-space: nowrap;
}

.call-status-interested {
    background: linear-gradient(135deg, #E0E7FF 0%, #C7D2FE 100%);
    color: #3730A3;
    border: 1px solid #A5B4FC;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-block;
    white-space: nowrap;
}

.call-status-not-interested {
    background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
    color: #991B1B;
    border: 1px solid #FCA5A5;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-block;
    white-space: nowrap;
}

.call-status-callback {
    background: linear-gradient(135deg, #DBEAFE 0%, #BFDBFE 100%);
    color: #1E40AF;
    border: 1px solid #93C5FD;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-block;
    white-space: nowrap;
}

/* ===== TOGGLE SWITCH STYLING ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Toggle switch container */
.relative.inline-flex.items-center.cursor-pointer {
    display: inline-flex;
    align-items: center;
    position: relative;
    cursor: pointer;
}

/* Toggle switch track */
.w-11.h-6.bg-gray-200 {
    width: 44px;
    height: 24px;
    background-color: #e5e7eb;
    border-radius: 12px;
    position: relative;
    transition: background-color 0.3s;
}

/* Toggle switch knob (after pseudo-element) */
.w-11.h-6.bg-gray-200::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Checked state - blue background */
.peer:checked ~ .w-11.h-6.bg-gray-200 {
    background-color: #2563eb !important;
}

/* Checked state - move knob to right */
.peer:checked ~ .w-11.h-6.bg-gray-200::after {
    transform: translateX(20px);
}

/* Focus ring */
.peer:focus ~ .w-11.h-6.bg-gray-200 {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* ===== BEAUTIFUL SCRIPT COLLAPSIBLE ===== */
.script-collapsible {
    border: none;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
}

.script-collapsible:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.script-collapsible-header {
    background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    color: white;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.script-collapsible-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.script-collapsible-header:hover::before {
    left: 100%;
}

.script-collapsible-header:hover {
    background: linear-gradient(135deg, #7C3AED 0%, #6D28D9 100%);
}

.script-collapsible-header:active {
    transform: scale(0.98);
}

/* Opening Script Special Styling */
.script-collapsible:first-child .script-collapsible-header {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.script-collapsible:first-child .script-collapsible-header:hover {
    background: linear-gradient(135deg, #D97706 0%, #B45309 100%);
}

/* Rebuttals Special Styling */
.script-collapsible:not(:first-child) .script-collapsible-header {
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
}

.script-collapsible:not(:first-child) .script-collapsible-header:hover {
    background: linear-gradient(135deg, #7C3AED 0%, #6D28D9 100%);
}

.script-collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(to bottom, #FAFAFA 0%, #FFFFFF 100%);
}

.script-collapsible-content.open {
    max-height: 800px;
}

.script-collapsible-body {
    padding: 1.5rem;
    background: white;
    white-space: pre-wrap;
    line-height: 1.8;
    color: #374151;
    font-size: 1.05rem;
    border-top: 3px solid #F3F4F6;
    animation: fadeInContent 0.4s ease;
}

@keyframes fadeInContent {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.script-arrow {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.script-arrow.open {
    transform: rotate(90deg);
}

/* ===== ANIMATIONS ===== */
@keyframes pulse-glow {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
    }
    50% {
        opacity: 0.8;
        box-shadow: 0 0 30px rgba(245, 158, 11, 0.6);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse-indicator {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
}

/* ===== UTILITY CLASSES ===== */
.animate-fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

.animate-slide-in {
    animation: slideIn 0.3s ease-out;
}

.transition-smooth {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== ONLINE INDICATOR ===== */
.online-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    position: relative;
}

.online-indicator.active {
    background-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
    animation: pulse-indicator 2s infinite;
}

.online-indicator.inactive {
    background-color: #6b7280;
    box-shadow: 0 0 0 2px rgba(107, 115, 128, 0.2);
}

/* ===== DATA TABLE ===== */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 12px;
    overflow: hidden;
}

.data-table th {
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, #F9FAFB 0%, #F3F4F6 100%);
    z-index: 10;
    padding: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: #6B7280;
    border-bottom: 2px solid #E5E7EB;
}

.data-table tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid #F3F4F6;
}

.data-table tbody tr:hover {
    background-color: #F9FAFB;
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* ===== SIDEBAR SCROLL ===== */
.sidebar-scroll {
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

.sidebar-scroll::-webkit-scrollbar {
    width: 6px;
}

.sidebar-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.sidebar-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ===== PERMISSION CARD ===== */
.permission-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid transparent;
    border-radius: 8px;
    padding: 1rem;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.permission-card:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.permission-card.enabled {
    border-left-color: #10b981;
    background: linear-gradient(to right, rgba(16, 185, 129, 0.05) 0%, white 100%);
}

.permission-card.disabled {
    border-left-color: #ef4444;
    opacity: 0.7;
    background: linear-gradient(to right, rgba(239, 68, 68, 0.05) 0%, white 100%);
}

/* ===== TAG STYLES ===== */
.tag {
    display: inline-block;
    padding: 0.375rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* ===== REBUTTAL CARD ===== */
.rebuttal-card {
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #F9FAFB 0%, #FFFFFF 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.rebuttal-card:hover {
    border-color: #6366F1;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

.rebuttal-remove-btn {
    color: #ef4444;
    background: transparent;
    border: none;
    cursor: pointer;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.rebuttal-remove-btn:hover {
    background-color: #FEE2E2;
    transform: scale(1.05);
}

/* ===== SCRIPT SECTION CARD ===== */
.script-section-card {
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.script-section-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.script-section-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.script-section-card.drop-zone {
    border-color: #6366f1;
    background-color: #EEF2FF;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.script-section-header {
    background: linear-gradient(135deg, #F9FAFB 0%, #F3F4F6 100%);
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #E5E7EB;
    border-radius: 12px 12px 0 0;
}

.script-section-title-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.script-section-drag-handle {
    cursor: move;
    color: #9ca3af;
    transition: color 0.2s ease;
}

.script-section-drag-handle:hover {
    color: #6366f1;
}

.script-section-title-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1.125rem;
    font-weight: 600;
    outline: none;
    color: #1F2937;
}

.script-section-actions {
    display: flex;
    gap: 0.5rem;
}

.script-section-action-btn {
    padding: 0.5rem;
    border-radius: 8px;
    color: #6b7280;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.script-section-action-btn:hover {
    background-color: #E5E7EB;
    color: #1F2937;
    transform: scale(1.1);
}

.script-section-content {
    padding: 1.5rem;
}

.script-section-textarea {
    width: 100%;
    min-height: 120px;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    padding: 1rem;
    resize: vertical;
    font-family: inherit;
    transition: all 0.2s ease;
}

.script-section-textarea:focus {
    outline: none;
    border-color: #6366F1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* ===== BEAUTIFUL BUTTONS ===== */
button,
.btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

button:hover,
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

button:active,
.btn:active {
    transform: translateY(0);
}

/* ===== LEAD INFO CARDS ===== */
.bg-gray-50 {
    background: linear-gradient(135deg, #F9FAFB 0%, #F3F4F6 100%) !important;
    border: 1px solid #E5E7EB;
    transition: all 0.3s ease;
}

.bg-gray-50:hover {
    background: linear-gradient(135deg, #F3F4F6 0%, #E5E7EB 100%) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* ===== PROGRESS BAR ===== */
#progress-bar {
    background: linear-gradient(90deg, #6366F1 0%, #8B5CF6 100%);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-notification {
    animation: slideInRight 0.3s ease-out;
    transition: all 0.3s ease;
    position: fixed;
    top: 4rem;
    right: 1rem;
    z-index: 10000;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast-notification.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.toast-notification.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.toast-notification.info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== TEXT ENHANCEMENTS ===== */
h1 {
    font-size: 2rem;
    line-height: 1.3;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.02em;
    text-shadow: 0 0 1px rgba(0, 0, 0, 0.1);
}

h2 {
    font-size: 1.5rem;
    line-height: 1.4;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.02em;
    text-shadow: 0 0 1px rgba(0, 0, 0, 0.1);
}

h3 {
    font-size: 1.25rem;
    line-height: 1.4;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.02em;
    text-shadow: 0 0 1px rgba(0, 0, 0, 0.1);
}

input,
textarea,
select {
    font-size: 1rem !important;
    font-weight: 500 !important;
    color: #1F2937 !important;
    letter-spacing: 0.01em !important;
    line-height: 1.5 !important;
}

input::placeholder,
textarea::placeholder {
    color: #9CA3AF !important;
    font-weight: 400 !important;
}

/* Table text */
.data-table th {
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    color: #4B5563;
    text-transform: uppercase;
}

.data-table td {
    font-size: 0.95rem;
    font-weight: 500;
    color: #1F2937;
    line-height: 1.5;
}

/* Call outcome display */
#call-outcome-display {
    background: #f9fafb;
    border-radius: 8px;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    min-width: 300px;
}

#current-call-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    min-width: 120px;
    text-align: center;
}

#last-call-time {
    font-size: 0.75rem;
    color: #6b7280;
}

/* Quick status buttons */
#quick-status-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

#quick-status-buttons button {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
    border: 1px solid #e5e7eb;
    background: white;
    cursor: pointer;
}

#quick-status-buttons button:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Filter results display */
#filter-result {
    background: #f9fafb;
    border-radius: 6px;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    font-size: 0.875rem;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .script-collapsible-header {
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    .script-collapsible-body {
        padding: 1rem;
        font-size: 0.95rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
    }
    
    .role-badge {
        font-size: 0.7rem;
        padding: 3px 8px;
    }
    
    .call-status-not-called,
    .call-status-connected,
    .call-status-voicemail,
    .call-status-interested,
    .call-status-not-interested,
    .call-status-callback {
        min-width: 100px;
        font-size: 0.75rem;
        padding: 4px 8px;
    }
    
    .status-active-bg,
    .status-inactive-bg,
    .status-busy-bg,
    .status-away-bg {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
    
    /* Mobile modal fixes */
    .modal-backdrop {
        padding: 0.5rem;
    }
    
    .modal-backdrop > div {
        max-width: 95vw;
        max-height: 95vh;
    }
    
    #mapping-modal .grid.grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    #mapping-fields {
        max-height: 40vh;
    }
}

@media (max-width: 640px) {
    #cloud-status-bar .flex:last-child {
        display: none;
    }
    
    .w-72.bg-gradient-to-br {
        width: 4rem;
    }
    
    .w-72.bg-gradient-to-br nav span:not(.online-indicator) {
        display: none;
    }
    
    .w-72.bg-gradient-to-br nav button {
        justify-content: center;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    .w-72.bg-gradient-to-br nav button svg {
        margin-right: 0;
    }
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */
/* Focus states for accessibility */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .status-active,
    .status-busy,
    .status-away,
    .status-inactive {
        border: 2px solid currentColor;
    }
    
    .call-status-connected,
    .call-status-voicemail,
    .call-status-interested,
    .call-status-not-interested,
    .call-status-callback {
        border: 2px solid currentColor;
    }
}

/* ===== CUSTOM SCROLLBARS ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ===== COLOR UTILITIES ===== */
/* For status colors in JavaScript generated content */
.bg-red-500 { background-color: #ef4444 !important; }
.bg-green-500 { background-color: #10b981 !important; }
.bg-blue-500 { background-color: #3b82f6 !important; }
.bg-yellow-500 { background-color: #f59e0b !important; }
.bg-purple-500 { background-color: #8b5cf6 !important; }
.bg-gray-500 { background-color: #6b7280 !important; }

.text-red-500 { color: #ef4444 !important; }
.text-green-500 { color: #10b981 !important; }
.text-blue-500 { color: #3b82f6 !important; }
.text-yellow-500 { color: #f59e0b !important; }
.text-purple-500 { color: #8b5cf6 !important; }
.text-gray-500 { color: #6b7280 !important; }

/* ===== FIX FOR SELECT DROPDOWNS ===== */
select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* ===== PRINT STYLES ===== */
@media print {
    .hide, 
    .modal-backdrop,
    #cloud-status-bar,
    .w-72.bg-gradient-to-br {
        display: none !important;
    }
    
    body {
        padding-top: 0 !important;
    }
    
    .flex.h-screen {
        height: auto !important;
    }
}