/*
 * VisitorX Pro CSS Styling
 * This file contains basic styling for the admin table and other elements,
 * and now includes styling for the Smart Offer Popup and enhanced dashboard.
 */

/* Admin Pages General Styling */
.wrap {
    margin-top: 20px;
}

h1 {
    margin-bottom: 20px;
    color: #333;
}

/* Leads Table Styling */
.wp-list-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    border: 1px solid #e0e0e0; /* Add a border to the whole table */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); /* Subtle shadow */
    border-radius: 8px; /* Rounded corners for the table */
    overflow: hidden; /* Ensures rounded corners clip content */
}

.wp-list-table th,
.wp-list-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid #e9ecef; /* Lighter border for rows */
    vertical-align: middle;
    font-size: 0.95em;
    color: #495057;
}

.wp-list-table th {
    background-color: #f8f9fa; /* Lighter header background */
    font-weight: 600;
    color: #343a40;
    cursor: pointer;
    position: relative;
    padding: 15px 10px; /* More padding in header */
    border-bottom: 2px solid #dee2e6; /* Stronger header bottom border */
}

/* Sorting indicators */
.wp-list-table th.sortable a {
    text-decoration: none;
    color: inherit;
    display: block;
    padding-right: 20px;
}

.wp-list-table th .sorting-indicator {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
}

.wp-list-table th.sortable .sorting-indicator {
    border-top: 5px solid #aaa; /* Default for unsorted */
}

.wp-list-table th.sorted.asc .sorting-indicator {
    border-bottom: 5px solid #007bff; /* Primary blue for sorted */
    border-top: none;
}

.wp-list-table th.sorted.desc .sorting-indicator {
    border-top: 5px solid #007bff; /* Primary blue for sorted */
    border-bottom: none;
}


.wp-list-table tbody tr:nth-child(even) {
    background-color: #fcfcfc; /* Very light subtle stripe */
}

.wp-list-table tbody tr:hover {
    background-color: #e2f0ff; /* Light blue on hover */
    transition: background-color 0.2s ease-in-out;
}

/* Pagination and Actions */
.tablenav {
    height: auto;
    min-height: 40px;
    margin: 15px 0; /* More margin */
    line-height: 34px; /* Adjust line height */
    display: flex;
    justify-content: space-between; /* Space out items */
    align-items: center;
}

.tablenav .alignleft {
    float: none; /* Remove float for flexbox */
}

.tablenav .tablenav-pages {
    float: none; /* Remove float for flexbox */
}

.tablenav .pagination-links {
    display: inline-flex; /* Use inline-flex for pagination links */
    vertical-align: middle;
    align-items: center;
    gap: 5px; /* Gap between page numbers */
}

.tablenav .page-numbers {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: 34px; /* Minimum width for square buttons */
    height: 34px;
    padding: 0 8px;
    margin: 0; /* Remove margin, use gap */
    border: 1px solid #ced4da;
    background-color: #fff;
    text-decoration: none;
    color: #007bff;
    border-radius: 5px; /* Slightly more rounded */
    transition: all 0.2s ease;
}

.tablenav .page-numbers.current {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
    box-shadow: 0 2px 5px rgba(0,123,255,0.2);
}

.tablenav .page-numbers:hover:not(.current) {
    background-color: #e9ecef;
    border-color: #007bff;
    color: #0056b3;
}

/* Search and Filter Controls */
.visitorx-filter-controls {
    margin-bottom: 25px; /* More margin */
    padding: 20px; /* More padding */
    border: 1px solid #dcdfe6; /* Softer border */
    background-color: #fff;
    border-radius: 10px; /* More rounded corners */
    box-shadow: 0 5px 15px rgba(0,0,0,0.08); /* Stronger shadow */
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px; /* Increased gap */
}

.visitorx-filter-controls form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px; /* Increased gap */
    width: 100%;
}

.visitorx-filter-controls .search-box,
.visitorx-filter-controls .date-filter {
    display: flex;
    gap: 10px;
    align-items: center;
}

.visitorx-filter-controls .search-box input[type="search"] {
    flex-grow: 1;
    min-width: 180px;
    padding: 10px 15px; /* More padding */
    border: 1px solid #ced4da;
    border-radius: 8px; /* Rounded input */
    font-size: 1em;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.08);
    transition: all 0.2s ease;
}
.visitorx-filter-controls .search-box input[type="search"]:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.25);
    outline: none;
}

.visitorx-filter-controls .date-filter input[type="date"] {
    padding: 10px 15px; /* More padding */
    border: 1px solid #ced4da;
    border-radius: 8px; /* Rounded input */
    font-size: 1em;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.08);
    transition: all 0.2s ease;
}
.visitorx-filter-controls .date-filter input[type="date"]:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.25);
    outline: none;
}

.visitorx-filter-controls .button {
    height: 38px; /* Slightly taller buttons */
    line-height: 34px;
    padding: 0 18px;
    margin-top: 0;
    border-radius: 8px; /* More rounded buttons */
    font-size: 0.95em;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.visitorx-filter-controls .button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Analytics Page Styling */
.visitorx-analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); /* Adjusted min-width for more cards per row */
    gap: 25px; /* More space between cards */
    margin-bottom: 35px;
}

.visitorx-card {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px; /* More rounded cards */
    padding: 25px; /* More padding */
    box-shadow: 0 8px 16px rgba(0,0,0,0.15); /* Prominent shadow */
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}
.visitorx-card:hover {
    transform: translateY(-5px); /* Lift on hover */
    box-shadow: 0 12px 24px rgba(0,0,0,0.25);
}

.visitorx-card h3 {
    margin-top: 0;
    margin-bottom: 15px; /* More space below title */
    font-size: 1.15em; /* Slightly larger title */
    color: #495057; /* Darker grey */
    font-weight: 600;
}

.visitorx-metric {
    font-size: 3em; /* Larger metric number */
    font-weight: bold;
    color: #007bff; /* Default metric color */
    margin: 0;
    line-height: 1.1;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.05);
}

/* Specific card colors for more visual appeal */
.visitorx-card-primary .visitorx-metric { color: #007bff; } /* Blue */
.visitorx-card-success .visitorx-metric { color: #28a745; } /* Green */
.visitorx-card-info .visitorx-metric { color: #17a2b8; }    /* Cyan */
.visitorx-card-warning .visitorx-metric { color: #ffc107; } /* Yellow */
.visitorx-card-secondary .visitorx-metric { color: #6c757d; } /* Grey */
.visitorx-card-conversion .visitorx-metric { color: #6f42c1; } /* Purple */
.visitorx-card-return .visitorx-metric { color: #fd7e14; }   /* Orange */
.visitorx-card-clicks .visitorx-metric { color: #dc3545; }   /* Red */


.visitorx-analytics-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); /* Adjusted min-width for charts */
    gap: 25px; /* More space between chart cards */
}

.visitorx-chart-full-width {
    grid-column: 1 / -1;
}

.visitorx-chart-card {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px; /* More rounded */
    padding: 25px; /* More padding */
    box-shadow: 0 8px 16px rgba(0,0,0,0.1); /* Stronger shadow */
}

.visitorx-chart-card h3 {
    margin-top: 0;
    margin-bottom: 20px; /* More space */
    font-size: 1.2em; /* Slightly larger */
    color: #343a40;
    border-bottom: 1px solid #eee;
    padding-bottom: 12px;
}

.visitorx-chart-card ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.visitorx-chart-card li {
    padding: 10px 0; /* More padding */
    border-bottom: 1px dotted #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95em;
    color: #495057;
}

.visitorx-chart-card li:last-child {
    border-bottom: none;
}

.visitorx-chart-card li a {
    color: #007bff;
    text-decoration: none;
    transition: color 0.2s ease;
}

.visitorx-chart-card li a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Settings Page Styling */
.form-table th {
    width: 30%; /* Slightly wider labels */
    padding-top: 20px;
    padding-bottom: 20px;
}

.form-table td {
    padding-top: 15px;
    padding-bottom: 15px;
}

.form-table .description {
    font-style: normal; /* Remove italic */
    font-size: 0.9em;
    color: #6c757d; /* Darker grey */
    margin-top: 8px; /* More space */
}
.form-table .description code {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 0.85em;
    color: #e83e8c; /* Highlight code snippets */
}

/* Checkbox styling */
input[type="checkbox"] {
    margin-right: 8px; /* More space */
    transform: scale(1.1); /* Slightly larger checkbox */
}

/* Dashicons for returning visitor */
.dashicons-yes-alt {
    color: #28a745; /* Success Green */
}

.dashicons-no-alt {
    color: #dc3545; /* Danger Red */
}

/* --- Smart Offer Popup Styling --- */
#visitorx-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85); /* Even darker overlay for more focus */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    animation: fadeIn 0.4s ease-out; /* Slightly slower fade in */
}

#visitorx-popup-card {
    background: linear-gradient(160deg, #ffffff, #f0f0f0); /* Clean white to light gray gradient */
    border-radius: 25px; /* More rounded corners */
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), /* Stronger, more defined shadow */
                0 0 0 10px rgba(255, 255, 255, 0.4); /* Wider, brighter inner glow */
    max-width: 600px; /* Wider popup */
    width: 90%;
    padding: 40px; /* More padding */
    position: relative;
    text-align: center;
    overflow: hidden;
    animation: slideIn 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards; /* Bouncier animation */
    transform: translateY(-70px) scale(0.7); /* Start further up, smaller */
    opacity: 0;
    border: 1px solid rgba(200, 200, 200, 0.5); /* Subtle grey border */
    transform-style: preserve-3d; /* Enable 3D transforms */
    perspective: 1000px; /* For real 3D depth */
}

.visitorx-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #e0e0e0; /* Light gray background */
    border: none;
    font-size: 30px; /* Even larger icon */
    cursor: pointer;
    color: #777;
    transition: all 0.3s ease-in-out;
    padding: 8px 12px; /* More padding for a better tap target */
    border-radius: 50%;
    line-height: 1; /* Center text vertically */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2); /* Small shadow for depth */
}

.visitorx-close-btn:hover {
    color: #444;
    transform: rotate(180deg) scale(1.1);
    background-color: #d0d0d0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.visitorx-popup-header {
    margin-bottom: 30px;
}

.visitorx-popup-header h2 {
    font-family: 'Inter', sans-serif; /* Professional font */
    font-size: 2.2em; /* Even larger, more impactful title */
    color: #1a2a3a; /* Deep blue/black for professionalism */
    margin-top: 15px;
    line-height: 1.2;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.15); /* More pronounced text shadow */
    font-weight: 700; /* Bolder */
}

.visitorx-product-image {
    max-width: 150px; /* Even larger image */
    height: auto;
    border-radius: 15px; /* More rounded image */
    margin-bottom: 25px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3); /* Very strong shadow for image depth */
    border: 3px solid #fff; /* Thicker white border */
    transform: translateZ(20px); /* Lift image off the card for 3D */
    transition: transform 0.3s ease-out;
}
.visitorx-product-image:hover {
    transform: translateZ(30px) scale(1.05); /* Even more lift on hover */
}

.visitorx-popup-body form {
    display: flex;
    flex-direction: column;
    gap: 20px; /* More spacing between form fields */
}

.visitorx-form-group {
    position: relative;
    /* Add optional label or icon if desired for more premium feel */
}

.validation-error-message {
    font-size: 0.95em;
    color: #e74c3c; /* Red for error */
    font-weight: bold;
    margin-top: -10px; /* Adjust spacing above fields */
    margin-bottom: 15px; /* Adjust spacing below fields */
}

.visitorx-popup-body input[type="text"],
.visitorx-popup-body input[type="tel"],
.visitorx-popup-body textarea {
    width: calc(100% - 40px); /* Adjusted for padding and border */
    padding: 18px 20px; /* More padding */
    border: 2px solid #e0e6ed; /* Slightly thicker, softer border */
    border-radius: 12px; /* More rounded fields */
    font-size: 1.1em;
    color: #34495e; /* Darker text */
    background-color: #f8fcfd; /* Very light blue/grey background */
    box-shadow: inset 0 3px 8px rgba(0,0,0,0.1); /* Stronger inner shadow */
    transition: all 0.3s ease;
    transform: translateZ(5px); /* Lift inputs slightly */
}

.visitorx-popup-body input:focus,
.visitorx-popup-body textarea:focus {
    border-color: #3498db; /* Professional blue on focus */
    box-shadow: 0 0 0 5px rgba(52, 152, 219, 0.3), inset 0 3px 8px rgba(0,0,0,0.15);
    outline: none;
    background-color: #fff;
    transform: translateZ(10px) translateY(-2px); /* Lift more on focus */
}

.visitorx-button-group {
    display: flex;
    flex-direction: column;
    gap: 18px; /* Spacing between buttons */
    margin-top: 30px;
}


.visitorx-submit-btn,
.visitorx-decline-btn {
    padding: 18px 35px; /* More padding */
    border: none;
    border-radius: 15px; /* More rounded buttons */
    cursor: pointer;
    font-size: 1.3em; /* Larger text */
    font-weight: 700; /* Bolder */
    letter-spacing: 0.8px; /* More letter spacing */
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* Smooth cubic bezier transition */
    box-shadow: 0 8px 15px rgba(0,0,0,0.3); /* Stronger shadow */
    position: relative;
    top: 0;
    left: 0;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3); /* More pronounced text shadow */
    transform: translateZ(10px); /* Lift buttons for 3D effect */
    text-transform: uppercase; /* Uppercase text for professional look */
}

.visitorx-submit-btn {
    background: linear-gradient(160deg, #27ae60, #229a55); /* Vibrant green gradient */
    color: white;
}

.visitorx-submit-btn:hover {
    background: linear-gradient(160deg, #229a55, #27ae60);
    box-shadow: 0 12px 20px rgba(0,0,0,0.4), 0 0 0 4px rgba(39, 174, 96, 0.3); /* Enhanced hover shadow and glow */
    transform: translateY(-5px) translateZ(15px); /* Lift more on hover */
}
.visitorx-submit-btn:active {
    transform: translateY(1px) translateZ(5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.visitorx-decline-btn {
    background: linear-gradient(160deg, #e74c3c, #c0392b); /* Professional red gradient */
    color: white;
}

.visitorx-decline-btn:hover {
    background: linear-gradient(160deg, #c0392b, #e74c3c);
    box-shadow: 0 12px 20px rgba(0,0,0,0.4), 0 0 0 4px rgba(231, 76, 60, 0.3);
    transform: translateY(-5px) translateZ(15px);
}
.visitorx-decline-btn:active {
    transform: translateY(1px) translateZ(5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Custom Thank You Message Styling */
.visitorx-thank-you-message {
    font-family: 'Inter', sans-serif;
    font-size: 1.6em; /* Slightly smaller to fit better */
    color: #28a745; /* Green for success */
    font-weight: 600;
    margin: 20px 0;
    line-height: 1.5;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.05);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-70px) scale(0.7); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}


/* Responsive adjustments */
@media (min-width: 600px) {
    .visitorx-button-group {
        flex-direction: row; /* Buttons side-by-side on larger screens */
        justify-content: center;
    }
    .visitorx-submit-btn,
    .visitorx-decline-btn {
        flex-grow: 1; /* Distribute space */
        max-width: 48%; /* Keep some gap */
    }
}

@media (max-width: 782px) {
    .wrap { margin-top: 10px; }
    h1 { font-size: 1.8em; }

    .visitorx-filter-controls form {
        flex-direction: column;
        align-items: stretch;
    }
    .visitorx-filter-controls .search-box,
    .visitorx-filter-controls .date-filter {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    .visitorx-filter-controls .search-box input[type="search"],
    .visitorx-filter-controls .date-filter input[type="date"] {
        width: 100%;
        box-sizing: border-box;
    }
    .visitorx-filter-controls .button {
        width: 100%;
        box-sizing: border-box;
    }
    .form-table th, .form-table td {
        display: block;
        width: 100%;
        padding-left: 0;
    }
    .form-table th {
        padding-bottom: 0;
    }

    #visitorx-popup-card {
        padding: 25px;
        border-radius: 20px;
        box-shadow: 0 15px 30px rgba(0,0,0,0.4), 0 0 0 5px rgba(255,255,255,0.3); /* Adjusted shadow/glow for mobile */
    }
    .visitorx-popup-header h2 {
        font-size: 1.6em;
    }
    .visitorx-submit-btn,
    .visitorx-decline-btn {
        font-size: 1.1em;
        padding: 15px 25px;
    }
    .visitorx-product-image {
        max-width: 100px;
    }
    .visitorx-popup-body input,
    .visitorx-popup-body textarea {
        padding: 15px;
    }
    .visitorx-thank-you-message {
        font-size: 1.4em;
    }

    .visitorx-analytics-grid {
        grid-template-columns: 1fr; /* Stack cards on very small screens */
    }
    .visitorx-chart-card {
        padding: 15px;
    }
}
