/* Lead Genie Main CSS - Enhanced for All Forms with 12px Desktop Table Fonts */

/* ====================================================================
   BASE STYLES & RESET
   ====================================================================*/
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding: 15px;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    line-height: 1.4;
}

/* Add left margin for desktop layouts */
@media screen and (min-width: 769px) {
    body {
        padding-left: 40px;
        padding-right: 20px;
    }
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    animation: float 20s ease-in-out infinite;
    z-index: 1;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(1deg); }
}

/* ====================================================================
   GLOBAL FORM STYLES
   ====================================================================*/

/* Form containers */
.form-container, 
.page-container {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 30px);
    align-items: center;
    position: relative;
    z-index: 10;
}

/* Form wrapper for desktop centering */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    min-height: 0;
}

/* Main form containers */
.login-container, 
.box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    padding: 2rem 1.5rem;
    width: 100%;
    max-width: 420px;
    text-align: center;
    position: relative;
    z-index: 10;
    overflow: hidden;
    margin: auto;
}

/* Box styles for application forms */
.box {
    background-color: #f2f2f2;
    border-radius: 15px;
    border: 2px solid lightblue;
    padding: 15px;
    margin-bottom: 20px;
    text-align: left;
    max-width: none;
}

.boxFullWidth {
    background-color: #f2f2f2;
    border-radius: 15px;
    border: 2px solid lightblue;
    padding: 15px;
    margin-bottom: 20px;
    width: 100%;
}

.login-container::before,
.box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(45deg, #667eea, #764ba2);
}

/* ====================================================================
   FORM ELEMENTS - GLOBAL IMPROVEMENTS
   ====================================================================*/

/* Labels */
label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
    font-size: 1rem;
}
 
/* Form groups */
.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
    font-size: 1rem;
}

/* INPUT FIELDS - REDUCED HEIGHT AND IMPROVED STYLING */
.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="date"],
select {
    width: 100%;
    padding: 0.6rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 14px;
    height: 38px;
    transition: all 0.3s ease;
    background: #fff;
    box-sizing: border-box;
    font-family: inherit;
}

/* Mobile-specific input sizing */
@media screen and (max-width: 768px) {
    .form-control,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="url"],
    input[type="date"],
    select {
        font-size: 16px;
        height: 44px;
        padding: 0.75rem 1rem;
    }
}

/* Focus states */
.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Textarea styling */
textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.4;
    box-sizing: border-box;
}

@media screen and (max-width: 768px) {
    textarea {
        font-size: 16px;
        min-height: 100px;
    }
}

/* Checkbox and radio styling */
input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    margin-right: 0.5rem;
    accent-color: #667eea;
}

/* Password container with eye icon */
.password-container {
    position: relative;
}

.password-toggle,
.password-toggle-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #6c757d;
    font-size: 1rem;
    padding: 0.25rem;
    transition: color 0.3s ease;
    z-index: 5;
}

.password-toggle:hover,
.password-toggle-btn:hover {
    color: #667eea;
}

/* ====================================================================
   BUTTON STYLES
   ====================================================================*/

/* Base button styles */
.btn,
button,
input[type="submit"],
input[type="button"] {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    box-sizing: border-box;
    min-height: 44px;
    min-width: 44px;
}

/* Rounded button style (application specific) */
.rounded {
    border: 2px solid #007bff;
    border-radius: 20px;
    padding: 0.5rem 1rem;
    margin: 0.25rem;
    cursor: pointer;
    font-size: 16px;
    background: white;
    color: #007bff;
    transition: all 0.3s ease;
    min-width: 80px;
    height: auto;
}

.rounded:hover {
    background: #f8f9fa;
    transform: translateY(-1px);
}

.rounded.selected {
    background-color: #007bff !important;
    color: white !important;
}

/* Primary button */
.btn-primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* Secondary button */
.btn-secondary {
    background: #f8f9fa;
    color: #6c757d;
    border: 2px solid #e9ecef;
}

.btn-secondary:hover {
    background: #e9ecef;
    color: #495057;
    transform: translateY(-1px);
}

/* Button link */
.btn-link {
    background: none;
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    padding: 0.5rem;
}

.btn-link:hover {
    color: #5a6fd8;
    text-decoration: underline;
}

/* ====================================================================
   TABLE STYLES - 12px FONT FOR DESKTOP - UNIFIED
   ====================================================================*/

/* Base table styling - applies to ALL tables */
table {
    border-collapse: collapse !important;
    border-spacing: 0 !important;
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

/* Desktop table styling - 12px font */
@media screen and (min-width: 769px) {
    table th, 
    table td {
        padding: 2px 4px !important;
        height: auto !important;
        min-height: 14px !important;
        font-size: 16px !important;
        line-height: 0.4 !important;
        vertical-align: middle !important;
        border: 1px solid #ddd !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    table tr {
        height: 18px !important;
        max-height: 18px !important;
        min-height: 18px !important;
    }
    
    /* Desktop table buttons - separate class for table-specific buttons */
    table .table-btn {
        border: 2px solid #007bff !important;
        border-radius: 20px !important;
        padding: 0px 10px !important;
        margin: 0px !important;
        cursor: pointer !important;
        font-size: 14px !important;
        background: white !important;
        color: #007bff !important;
        transition: all 0.3s ease !important;
        min-width: 40px !important;
        height: 10px !important;
        line-height: 1 !important;
        display: inline-block !important;
        vertical-align: middle !important;
        box-sizing: border-box !important;
        white-space: nowrap !important;
        text-align: center !important;
        font-weight: normal !important;
    }

    table .table-btn:hover {
        background: #f8f9fa !important;
        transform: translateY(-1px) !important;
    }

    table .table-btn.selected {
        background-color: #007bff !important;
        color: white !important;
    }

    table .rounded:hover {
        background: #f8f9fa !important;
        transform: translateY(-1px) !important;
    }

    table .rounded.selected {
        background-color: #007bff !important;
        color: white !important;
    }
    
    /* Desktop action cells */
    table td[style*="white-space: nowrap"] {
        padding: 4px 6px !important;
        height: auto !important;
        min-height: 20px !important;
        overflow: visible !important;
        white-space: nowrap !important;
        vertical-align: middle !important;
    }

    /* Desktop forms in tables */
    table form {
        margin: 0 !important;
        padding: 0 !important;
        display: inline !important;
        line-height: 1.2 !important;
        height: auto !important;
    }

    /* Desktop inputs in tables */
    table input {
        border: none !important;
        width: 100% !important;
        text-align: left !important;
        padding: 2px 4px !important;
        font-size: 14px !important;
        height: auto !important;
        margin: 0 !important;
        line-height: 1.2 !important;
        box-sizing: border-box !important;
    }

    table input[type="hidden"] {
        display: none !important;
    }

    /* Desktop text inputs in form tables get proper styling */
    table input[type="text"] {
        border: 1px solid #ccc !important;
        padding: 4px 6px !important;
        font-size: 14px !important;
        background: white !important;
        border-radius: 4px;
        height: 28px !important;
    }
}

/* Mobile table styling - keep compact for mobile */
@media screen and (max-width: 768px) {
    table th, 
    table td {
        padding: 8px 4px !important;
        height: auto !important;
        font-size: 16px !important;
        line-height: 1.3 !important;
        vertical-align: middle !important;
        border: 1px solid #ddd !important;
        box-sizing: border-box !important;
        white-space: normal !important;
    }
    
    /* Mobile table buttons - larger for touch */
    table .rounded {
        padding: 6px 10px !important;
        font-size: 16px !important;
        min-height: 32px !important;
        height: auto !important;
        width: 100% !important;
        margin: 2px 0 !important;
        display: block !important;
    }
    
    /* Mobile table styling - stack cards */
    table thead {
        display: none;
    }
    
    table,
    table tbody,
    table tr,
    table td {
        display: block;
        width: 100%;
    }
    
    table tr {
        margin-bottom: 15px;
        padding: 15px;
        background: white;
        border-radius: 8px;
        border: 1px solid #ddd;
    }
    
    table td {
        position: relative;
        padding: 10px 0;
        border: none;
        text-align: left;
    }
    
    table td:before {
        content: attr(data-label) ": ";
        font-weight: bold;
        color: #333;
        display: block;
        margin-bottom: 5px;
    }
    
    table input[type="text"] {
        width: 100% !important;
        margin: 0 !important;
        height: 42px !important;
        font-size: 16px !important;
    }
}

/* Common table header styling */
table th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #333;
    text-align: center;
}

table td {
    text-align: left;
}

/* Center Dupe and Date Due columns - specific to leads tables 
table th:nth-child(2),  Dupe column header 
table td:nth-child(2)   Dupe column data  {
    text-align: center !important;
}

table th:nth-child(5),  Date Due column header (adjust number if needed) 
table td:nth-child(5)   Date Due column data  {
    text-align: center !important;
}

table th:nth-child(6),  If Salesperson column is showing, Date Due would be 6th column 
table td:nth-child(6) {
    text-align: center !important;
}*/

/* ZEBRA STRIPING */
table tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* PAGINATION - Desktop 12px */
@media screen and (min-width: 769px) {
    .selected_page,
    input[type="submit"][class*="selected"] {
        padding: 2px 6px !important;
        font-size: 11px !important;
        height: auto !important;
        line-height: 1.2 !important;
        margin: 2px !important;
        background-color: #007bff !important;
        color: white !important;
        border: 1px solid #007bff !important;
        border-radius: 4px !important;
    }

    form[style*="display: inline-block"] input[type="submit"] {
        padding: 2px 6px !important;
        font-size: 11px !important;
        height: auto !important;
        margin: 2px !important;
        border: 1px solid #ddd !important;
        background: white !important;
        border-radius: 4px !important;
        cursor: pointer;
    }

    form[style*="display: inline-block"] input[type="submit"]:hover {
        background-color: #f8f9fa !important;
    }
}

/* Mobile pagination - keep larger */
@media screen and (max-width: 768px) {
    .selected_page,
    input[type="submit"][class*="selected"] {
        padding: 8px 12px !important;
        font-size: 14px !important;
        height: auto !important;
        margin: 4px !important;
    }

    form[style*="display: inline-block"] input[type="submit"] {
        padding: 8px 12px !important;
        font-size: 14px !important;
        height: auto !important;
        margin: 4px !important;
    }
}

/* ====================================================================
   RESPONSIVE FORM LAYOUTS
   ====================================================================*/

/* Form rows */
.form-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    gap: 10px;
    width: 100%;
}

.form-row label {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
    font-size: 1rem;
}

/* Form row content container */
.form-row-content {
    display: flex;
    gap: 15px;
    width: 100%;
}

.textarea-container {
    flex: 1;
    min-width: 0;
}

/* AI Button Container */
.ai-button-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    width: 100%;
}

.ai-quick,
.ai-advanced {
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.ai-quick {
    background: #28a745;
    color: white;
}

.ai-quick:hover {
    background: #218838;
    transform: translateY(-1px);
}

.ai-advanced {
    background: #007cba;
    color: white;
}

.ai-advanced:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.ai-refinement-field {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    background: #f9f9fa;
    color: #666;
    box-sizing: border-box;
    height: 34px;
}

.ai-refinement-field:focus {
    border-color: #007cba;
    background: white;
    color: #333;
    outline: none;
}

.ai-refinement-field::placeholder {
    color: #999;
    font-style: italic;
}

/* ====================================================================
   DESKTOP SPECIFIC STYLES (769px and above)
   ====================================================================*/
@media screen and (min-width: 769px) {
    /* Desktop: AI buttons side by side with textarea */
    .form-row-content {
        flex-direction: row;
    }
    
    .textarea-container {
        flex: 1;
    }
    
    .ai-button-container {
        flex: 0 0 180px;
        min-width: 180px;
        max-width: 200px;
        margin-top: 0;
    }
    
    .ai-quick,
    .ai-advanced {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .ai-refinement-field {
        font-size: 12px;
        height: 30px;
        padding: 6px 8px;
    }
    
    /* Maintenance form specific adjustments */
    div[style*="margin-bottom: 10px"],
    div[style*="display: flex"][style*="align-items: center"] {
        max-width: 500px;
    }
    
    /* Override inline styles for better desktop appearance */
    input[type="text"][style*="width: 200px"] {
        width: 180px !important;
        height: 32px !important;
    }
    
    select[style*="width: 200px"] {
        width: 180px !important;
        height: 32px !important;
    }
    
    input[type="number"][style*="width: 50px"] {
        width: 60px !important;
        height: 32px !important;
    }
    
    textarea[style*="width: 220px"] {
        width: 300px !important;
        min-height: 70px !important;
    }
    
    .box[style*="width: 500px"] {
        width: 520px !important;
    }
}

/* ====================================================================
   MOBILE SPECIFIC STYLES (768px and below)
   ====================================================================*/
@media screen and (max-width: 768px) {
    body {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        background-attachment: scroll;
    }
    
    body::before {
        display: none;
    }


    .login-wrapper {
        align-items: flex-start;
        padding-top: 10px;
    }

    .login-container,
    .box,
    .boxFullWidth {
        padding: 1.5rem 1.25rem;
        margin: 0;
        max-width: none;
        border-radius: 15px;
        width: 100% !important;
    }
    
    /* Mobile form layout */
    .form-row-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .ai-button-container {
        width: 100%;
        margin-top: 15px;
    }
    
    .ai-quick,
    .ai-advanced {
        padding: 12px 16px;
        font-size: 16px;
    }
    
    .ai-refinement-field {
        height: 42px;
        font-size: 16px;
        padding: 10px 12px;
    }
    
    /* Stack maintenance form elements vertically */
    div[style*="margin-bottom: 10px"],
    div[style*="display: flex"][style*="align-items: center"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 5px;
    }
    
    div[style*="margin-bottom: 10px"] label,
    div[style*="display: flex"][style*="align-items: center"] label {
        width: 100% !important;
        min-width: auto !important;
        margin-bottom: 5px;
        text-align: left;
    }
}

/* ====================================================================
   ERROR MESSAGES AND ALERTS
   ====================================================================*/
.error-message {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    border: 1px solid #f5c6cb;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
}

.error-message i {
    margin-right: 0.5rem;
}

.ai-message {
    position: fixed;
    top: 20px;
    right: 20px;
    left: 20px;
    padding: 15px;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    z-index: 1000;
    text-align: center;
    animation: slideIn 0.3s ease-out;
}

.ai-message.success {
    background: #28a745;
}

.ai-message.error {
    background: #dc3545;
}

@keyframes slideIn {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ====================================================================
   ACCESSIBILITY AND FOCUS STYLES
   ====================================================================*/
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Focus states for table buttons */
table .rounded:focus {
    outline: 1px solid #007cba !important;
    outline-offset: 1px !important;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .box,
    .boxFullWidth {
        border-color: #000;
        border-width: 3px;
    }
    
    input, textarea, select {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ====================================================================
   UTILITY CLASSES
   ====================================================================*/
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 300px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -150px;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Loading states */
.ai-loading {
    display: none;
    color: #007cba;
    font-style: italic;
    font-size: 12px;
    text-align: center;
    padding: 8px;
}

/* Button groups */
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    justify-content: flex-start;
}

@media screen and (max-width: 768px) {
    .button-group {
        flex-direction: column;
    }
    
    .button-group .rounded {
        width: 100%;
        margin: 5px 0;
    }
}

/* ====================================================================
   PRINT STYLES
   ====================================================================*/
@media print {
    body {
        background: white;
        padding: 0;
    }

    .box,
    .boxFullWidth {
        border: 1px solid #000;
        background: white;
        break-inside: avoid;
    }

    .rounded,
    .ai-button-container,
    .password-toggle,
    .password-toggle-btn {
        display: none;
    }

    .ai-message {
        display: none;
    }
}

/* ====================================================================
   CAMPAIGN FORM SPECIFIC STYLES
   ====================================================================*/

/* Instructions box styling */
.instructions-box {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 15px;
    padding: 0px 10px;
    margin-bottom: 20px;
}

.instructions-toggle {
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Enhanced body styles with mobile fallback */
body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding: 15px;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    line-height: 1.4;
}

/* Desktop animated background */
@media screen and (min-width: 769px) {
    body::before {
        content: '';
        position: fixed; /* Changed from absolute to fixed for better desktop performance */
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
        animation: float 20s ease-in-out infinite;
        z-index: 1;
        pointer-events: none; /* Prevents interference with touch events */
    }
}

/* Mobile: Force background display */
@media screen and (max-width: 768px) {
    body {
        /* Force the same gradient on mobile */
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        background-attachment: scroll !important;
        background-size: cover !important;
        background-repeat: no-repeat !important;
        min-height: 100vh !important;
        min-height: -webkit-fill-available !important;
    }
    
    /* Remove the animated pseudo-element on mobile */
    body::before {
        display: none !important;
    }
    
    /* Ensure HTML element also has proper background */
    html {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        min-height: 100vh !important;
        min-height: -webkit-fill-available !important;
    }
}

/* Ensure proper viewport handling */
@media screen and (max-width: 768px) {
    html {
        /* Prevent zoom on input focus */
        -webkit-text-size-adjust: 100%;
        -moz-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }
    
    /* Fix for some mobile browsers */
    body {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
}

/* ====================================================================
   COMPACT TABLE STYLING FOR LEADS AND CAMPAIGNS TABLES
   ====================================================================*/

/* Compact table styling for both leads and campaigns tables */
.leads-table,
.campaigns-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Compact row height - applies to both table types */
.leads-table th,
.leads-table td,
.campaigns-table th,
.campaigns-table td {
    padding: 4px 8px !important;  /* Reduced from 8px 10px */
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    line-height: 1.2 !important;
}

/* Header styling for both table types */
.leads-table th,
.campaigns-table th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #333;
    border-bottom: 2px solid #dee2e6;
}

/* Hover effects for both table types */
.leads-table tr:hover,
.campaigns-table tr:hover {
    background-color: #f8f9fa;
}

/* Compact buttons for both table types */
.leads-table button,
.leads-table input[type="button"],
.campaigns-table button,
.campaigns-table input[type="button"] {
    padding: 2px 8px !important;  /* Reduced padding */
    font-size: 12px !important;   /* Slightly smaller font */
    min-height: 24px !important;  /* Reduced height */
    line-height: 1.2 !important;
    border-radius: 4px;
    margin: 1px 2px;
}

/* Table input styling for both types */
.leads-table input[type="text"],
.leads-table select,
.campaigns-table input[type="text"],
.campaigns-table select {
    width: 100% !important;
    border: none !important;
    background: transparent !important;
    padding: 4px 6px !important;
    height: 26px !important;
    font-size: 13px;
}

.leads-table input[type="text"]:focus,
.leads-table select:focus,
.campaigns-table input[type="text"]:focus,
.campaigns-table select:focus {
    background: white !important;
    border: 1px solid #007cba !important;
    border-radius: 4px !important;
}

/* Mobile responsive table styling for both types */
@media screen and (max-width: 768px) {
    .leads-table,
    .campaigns-table {
        font-size: 14px;
    }
    
    .leads-table,
    .leads-table thead,
    .leads-table tbody,
    .leads-table th,
    .leads-table td,
    .leads-table tr,
    .campaigns-table,
    .campaigns-table thead,
    .campaigns-table tbody,
    .campaigns-table th,
    .campaigns-table td,
    .campaigns-table tr {
        display: block;
    }
    
    .leads-table thead tr,
    .campaigns-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .leads-table tr,
    .campaigns-table tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
        padding: 10px;
        border-radius: 8px;
        background: white;
    }
    
    .leads-table td,
    .campaigns-table td {
        border: none;
        position: relative;
padding: 12px 0 12px 45% !important;;
width: 42%;
    }
    
    .leads-table td:before,
    .campaigns-table td:before {
        content: attr(data-label) ": " !important;;
        position: absolute !important;;
        left: 6px;
        width: 42% !important;;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: bold;
        color: #333;
    }
}

/* COMPACT LEADS TABLE - OVERRIDE CONFLICTING STYLES */
@media screen and (min-width: 769px) {
    .leads-table th,
    .leads-table td {
        padding: 4px 8px !important;
        line-height: 1.2 !important;
        font-size: 14px !important;
        height: auto !important;
        min-height: auto !important;
    }

    .leads-table button,
    .leads-table input[type="button"] {
        padding: 2px 8px !important;
        font-size: 12px !important;
        min-height: 24px !important;
        line-height: 1.2 !important;
        height: auto !important;
    }
}


/* Instructions section mobile styling */
@media screen and (max-width: 768px) {
    .instructions-box {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .instructions-toggle {
        font-size: 14px;
    }
}

/* Form inputs mobile optimization */
@media screen and (max-width: 768px) {
    .form-control,
    input[type="text"],
    input[type="email"],
    select {
        font-size: 16px; /* Prevents zoom on iOS */
        height: 44px;
        padding: 0.75rem 1rem;
    }
    
    textarea {
        font-size: 16px;
        min-height: 100px;
    }
}

/* ====================================================================
   CAMPAIGN DEFINITION TABLE MOBILE RESPONSIVE CSS
   ====================================================================*/
/* Campaign Definition Table Base Styling */
.campaignDef-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.campaignDef-table th,
.campaignDef-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.campaignDef-table th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #333;
    border-bottom: 2px solid #dee2e6;
}

/* Desktop styling for campaignDef-table */
@media screen and (min-width: 769px) {
    .campaignDef-table th,
    .campaignDef-table td {
        padding: 8px 10px;
        font-size: 14px;
    }
    
    .campaignDef-table input[type="text"] {
        width: 100%;
        padding: 4px 6px;
        font-size: 14px;
        border: 1px solid #ccc;
        border-radius: 4px;
        height: 28px;
    }
    
    .campaignDef-table input[type="checkbox"] {
        width: 18px;
        height: 18px;
    }
}

/* Mobile responsive styling for campaignDef-table */
@media screen and (max-width: 768px) {
    .campaignDef-table {
        font-size: 14px;
    }
    
    .campaignDef-table,
    .campaignDef-table thead,
    .campaignDef-table tbody,
    .campaignDef-table th,
    .campaignDef-table td,
    .campaignDef-table tr {
        display: block;
    }
    
    .campaignDef-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .campaignDef-table tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
        padding: 10px;
        border-radius: 8px;
        background: white;
    }
    
    .campaignDef-table td {
        border: none;
        position: relative;
    padding: 12px 0 12px 45% !important;
        text-align: left;
    }
    
    .campaignDef-table td:before {
        content: attr(data-label) ": " !important;
        position: absolute !important;
        left: 6px;
    width: 42% !important; 
        padding-right: 10px;
        white-space: nowrap;
        font-weight: bold;
        color: #333;
    }
    
    /* Style inputs within campaign table on mobile */
    .campaignDef-table input[type="text"] {
        width: 100% !important;
        font-size: 16px !important;
        height: 44px !important;
        padding: 0.75rem 1rem !important;
        border: 1px solid #ccc !important;
        border-radius: 4px !important;
        margin: 0 !important;
    }
    
    .campaignDef-table input[type="checkbox"] {
        transform: scale(1.5);
        margin: 0 auto !important;
        display: block !important;
    }
}

/* Preview button - exact same height as AI Assist button */
.ai-quick.preview {
    background: #6c757d !important;  /* Gray background instead of green */
    width: auto !important;          /* Override the 100% width from .ai-quick */
    min-width: 100px;               /* Set a reasonable minimum width */
    flex-shrink: 0;                 /* Don't shrink in flex containers */
    
    /* Force exact same dimensions as .ai-quick */
    padding: 10px 14px !important;  /* Match mobile padding exactly */
    height: auto !important;        /* Let height be determined by padding */
    box-sizing: border-box !important;
    font-size: 14px !important;     /* Match font size exactly */
    font-weight: 600 !important;    /* Match font weight exactly */
    line-height: normal !important; /* Ensure same line height */
}

.ai-quick.preview:hover {
    background: #5a6268 !important; /* Darker gray on hover */
    transform: translateY(-1px);    /* Keep the same hover animation */
}

/* Desktop: Match desktop AI Assist button exactly */
@media screen and (min-width: 769px) {
    .ai-quick.preview {
        padding: 8px 12px !important;  /* Match desktop padding exactly */
        font-size: 13px !important;    /* Match desktop font size exactly */
    }
}

.btn-delete {
    background-color: #dc3545 !important;
    color: white !important;
}

.btn-delete:hover {
    background-color: #c82333 !important;
    color: white !important;
}

.btn-print {
    background-color: #28a745 !important;
    color: white !important;
}

.btn-print:hover {
    background-color: #218838 !important;
}

