/* BizzyBees Professional Admin Styling */

/* Color Variables */
:root {
    --bizzybees-primary: #FFC107; /* Yellow */
    --bizzybees-primary-hover: #FFB300; /* Darker yellow */
    --bizzybees-secondary: #333333;
    --bizzybees-light-bg: #f9f9f9;
    --bizzybees-text: #333333;
    --bizzybees-text-light: #666666;
    --bizzybees-border: #e0e0e0;
    --bizzybees-success: #4CAF50;
    --bizzybees-warning: #FF9800;
    --bizzybees-error: #f44336;
}

/* Base Typography & Admin Page Styling */
.toplevel_page_bizzybees-settings #wpbody,
.bizzybees_page_bizzybees-logs #wpbody,
.bizzybees_page_bizzybees-multi-task #wpbody {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: var(--bizzybees-text);
}

/* Content Padding & Container */
.toplevel_page_bizzybees-settings #wpbody-content,
.bizzybees_page_bizzybees-logs #wpbody-content,
.bizzybees_page_bizzybees-multi-task #wpbody-content {
    padding-right: 20px !important;
}

.wrap {
    max-width: 100%;
    overflow-x: hidden;
}

/* Header Styling */
.toplevel_page_bizzybees-settings h1,
.bizzybees_page_bizzybees-logs h1,
.bizzybees_page_bizzybees-multi-task h1 {
    color: var(--bizzybees-secondary);
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--bizzybees-primary);
}

.toplevel_page_bizzybees-settings h2,
.bizzybees_page_bizzybees-logs h2,
.bizzybees_page_bizzybees-multi-task h2 {
    color: var(--bizzybees-secondary);
    font-size: 1.5em;
    margin: 1.5em 0 1em;
}

/* Description Text */
.toplevel_page_bizzybees-settings .description,
.bizzybees_page_bizzybees-multi-task .description {
    color: var(--bizzybees-text-light);
    font-style: italic;
    margin-top: 5px;
    word-wrap: break-word;
    max-width: 100%;
}

/* Buttons - Primary (Yellow) */
.toplevel_page_bizzybees-settings .button-primary,
.bizzybees_page_bizzybees-logs .button-primary,
.bizzybees_page_bizzybees-multi-task .button-primary,
.toplevel_page_bizzybees-settings input[type="submit"],
.bizzybees_page_bizzybees-logs input[type="submit"],
.bizzybees_page_bizzybees-multi-task input[type="submit"],
button.button-primary,
input.button-primary,
.button-primary,
.page-title-action,
#update-task,
.update-task,
.run-now-button,
button[type="submit"],
input[type="submit"],
.bizzybees-multi-task .button.button-primary {
    background: var(--bizzybees-primary-hover) !important;
    border-color: var(--bizzybees-primary) !important;
    color: white !important;
    font-weight: 600;
    padding: 0.4em 1em;
    height: auto;
    line-height: 1.5;
    border-radius: 4px;
    box-shadow: none;
    text-shadow: none;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.toplevel_page_bizzybees-settings .button-primary:hover,
.bizzybees_page_bizzybees-logs .button-primary:hover,
.bizzybees_page_bizzybees-multi-task .button-primary:hover,
.toplevel_page_bizzybees-settings input[type="submit"]:hover,
.bizzybees_page_bizzybees-logs input[type="submit"]:hover,
.bizzybees_page_bizzybees-multi-task input[type="submit"]:hover,
button.button-primary:hover,
input.button-primary:hover,
.button-primary:hover,
.page-title-action:hover,
#update-task:hover,
.update-task:hover,
.run-now-button:hover,
button[type="submit"]:hover,
input[type="submit"]:hover,
.bizzybees-multi-task .button.button-primary:hover {
    background: var(--bizzybees-primary) !important;
    border-color: var(--bizzybees-primary-hover) !important;
}

/* Buttons - Secondary */
.toplevel_page_bizzybees-settings .button-secondary,
.bizzybees_page_bizzybees-logs .button-secondary,
.bizzybees_page_bizzybees-multi-task .button-secondary,
.button.button-secondary,
.bizzybees-multi-task .button {
    background: #f0f0f0 !important;
    border-color: #cccccc !important;
    color: var(--bizzybees-text) !important;
    box-shadow: none;
    text-shadow: none;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.toplevel_page_bizzybees-settings .button-secondary:hover,
.bizzybees_page_bizzybees-logs .button-secondary:hover,
.bizzybees_page_bizzybees-multi-task .button-secondary:hover,
.button.button-secondary:hover,
.bizzybees-multi-task .button:hover {
    background: white !important;
    border-color: var(--bizzybees-primary) !important;
}

/* Special Buttons */
.button#toggle-advanced-settings,
.button#show-advanced-settings {
    display: inline-block;
    width: auto;
    max-width: 100%;
    box-sizing: border-box;
    white-space: normal;
    word-wrap: break-word;
    margin: 20px 0;
}

/* Emergency Stop Button */
button[name="bizzybees_emergency_stop"] {
    background-color: var(--bizzybees-error) !important;
    border-color: #d32f2f !important;
}

/* Form Elements Styling */
.toplevel_page_bizzybees-settings input[type="text"],
.toplevel_page_bizzybees-settings input[type="number"],
.toplevel_page_bizzybees-settings textarea,
.toplevel_page_bizzybees-settings select,
.bizzybees_page_bizzybees-logs input[type="text"],
.bizzybees_page_bizzybees-logs input[type="number"],
.bizzybees_page_bizzybees-logs textarea,
.bizzybees_page_bizzybees-logs select,
.bizzybees_page_bizzybees-multi-task input[type="text"],
.bizzybees_page_bizzybees-multi-task input[type="number"],
.bizzybees_page_bizzybees-multi-task textarea,
.bizzybees_page_bizzybees-multi-task select {
    border: 1px solid var(--bizzybees-border);
    border-radius: 4px;
    padding: 8px 12px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
    transition: border-color 0.15s ease-in-out;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
    white-space: normal;
}

.toplevel_page_bizzybees-settings input[type="text"]:focus,
.toplevel_page_bizzybees-settings input[type="number"]:focus,
.toplevel_page_bizzybees-settings textarea:focus,
.toplevel_page_bizzybees-settings select:focus,
.bizzybees_page_bizzybees-logs input[type="text"]:focus,
.bizzybees_page_bizzybees-logs input[type="number"]:focus,
.bizzybees_page_bizzybees-logs textarea:focus,
.bizzybees_page_bizzybees-logs select:focus,
.bizzybees_page_bizzybees-multi-task input[type="text"]:focus,
.bizzybees_page_bizzybees-multi-task input[type="number"]:focus,
.bizzybees_page_bizzybees-multi-task textarea:focus,
.bizzybees_page_bizzybees-multi-task select:focus {
    border-color: var(--bizzybees-primary);
    box-shadow: 0 0 0 1px var(--bizzybees-primary);
    outline: none;
}

/* Specific Form Elements */
input[type="text"], 
input[type="url"],
input[type="email"],
input[type="number"] {
    width: 250px !important;
    max-width: 100% !important;
}

/* Textarea Specific */
.toplevel_page_bizzybees-settings textarea,
.bizzybees_page_bizzybees-logs textarea,
.bizzybees_page_bizzybees-multi-task textarea {
    resize: vertical !important;
    max-width: 100% !important;
    width: 100% !important;
    overflow-x: hidden !important;
}

/* Checkbox Styling */
.toplevel_page_bizzybees-settings input[type="checkbox"],
.bizzybees_page_bizzybees-multi-task input[type="checkbox"] {
    border: 1px solid var(--bizzybees-border);
}

.toplevel_page_bizzybees-settings input[type="checkbox"]:checked::before,
.bizzybees_page_bizzybees-multi-task input[type="checkbox"]:checked::before {
    color: var(--bizzybees-primary);
}

/* Select Box Styling */
.toplevel_page_bizzybees-settings select,
.bizzybees_page_bizzybees-logs select,
.bizzybees_page_bizzybees-multi-task select,
.toplevel_page_bizzybees-settings .select2-container,
.bizzybees_page_bizzybees-multi-task .select2-container {
    width: 250px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    padding-right: 30px !important;
    min-height: 35px !important;
    white-space: normal;
}

.toplevel_page_bizzybees-settings select option,
.bizzybees_page_bizzybees-logs select option,
.bizzybees_page_bizzybees-multi-task select option {
    white-space: normal;
    word-wrap: break-word;
}

/* Specific Select Elements */
select[name="bizzybees_post_to_update"] {
    width: 400px !important;
    max-width: 100% !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

select[name="bizzybees_update_mode"],
select[name="bizzybees_post_action"], 
select[name="bizzybees_schedule_interval"] {
    min-width: 200px !important;
    padding-right: 30px !important;
}

/* Specific Textareas */
textarea[name="bizzybees_rewrite_prompt"],
textarea#bizzybees_rewrite_prompt {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Panel and Card Styling */
.bizzybees-panel,
.task-form-container,
.bizzybees-url-row {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    overflow: hidden;
    position: relative;
}

/* URL Row Styling */
.bizzybees-url-row {
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid var(--bizzybees-border);
    border-radius: 8px;
    background: #f9f9f9;
}

/* Scrape Prompt Box Styling */
.scrape-prompt-box {
    margin-top: 10px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 6px;
    border-left: 4px solid var(--bizzybees-primary);
}

/* Log Viewer Styling */
#bizzybees-log-viewer {
    border: 1px solid var(--bizzybees-border) !important;
    background-color: #111 !important;
    color: #00ff00 !important;
    font-family: 'Courier New', monospace !important;
    padding: 15px !important;
    border-radius: 8px !important;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1) !important;
}

/* Success/Error Message Styling */
.toplevel_page_bizzybees-settings .updated,
.bizzybees_page_bizzybees-logs .updated,
.bizzybees_page_bizzybees-multi-task .updated {
    border-left: 4px solid var(--bizzybees-success);
    background: #f0f8f0;
    box-shadow: none;
}

.toplevel_page_bizzybees-settings .error,
.bizzybees_page_bizzybees-logs .error,
.bizzybees_page_bizzybees-multi-task .error {
    border-left: 4px solid var(--bizzybees-error);
    background: #fff8f8;
    box-shadow: none;
}

/* Table Styling */
.toplevel_page_bizzybees-settings .form-table,
.bizzybees_page_bizzybees-logs .wp-list-table,
.bizzybees_page_bizzybees-multi-task .bizzybees-task-table {
    border-collapse: collapse;
    width: 100%;
    margin-top: 1em;
    border: 1px solid var(--bizzybees-border);
    background: white;
    border-radius: 8px;
    overflow: hidden;
    table-layout: fixed !important;
    max-width: 100% !important;
}

.toplevel_page_bizzybees-settings .form-table th,
.bizzybees_page_bizzybees-logs .wp-list-table th,
.bizzybees_page_bizzybees-multi-task .bizzybees-task-table th {
    background: #f5f5f5;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    width: 150px !important;
    max-width: 150px !important;
    word-break: break-word !important;
}

.toplevel_page_bizzybees-settings .form-table td,
.bizzybees_page_bizzybees-logs .wp-list-table td,
.bizzybees_page_bizzybees-multi-task .bizzybees-task-table td {
    padding: 12px 15px;
    border-top: 1px solid var(--bizzybees-border);
    width: auto !important;
    overflow: hidden !important;
    word-break: break-word;
}

/* Admin Menu Icon */
#adminmenu .toplevel_page_bizzybees-settings .wp-menu-image::before {
    color: var(--bizzybees-primary) !important;
}

/* Action buttons in task table */
.task-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
}

.task-actions .button,
.task-actions form {
    margin: 0 !important;
    display: inline-block !important;
}

/* Responsive Styles */
@media screen and (max-width: 782px) {
    /* Form table responsive styles */
    .form-table, 
    .form-table tbody, 
    .form-table tr, 
    .form-table th, 
    .form-table td {
        display: block;
        width: 100%;
        padding: 10px 0;
    }
    
    .form-table th {
        padding-bottom: 5px;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .form-table td {
        padding-top: 0;
        padding-bottom: 15px;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Task table horizontal scrolling */
    .bizzybees_page_bizzybees-multi-task .bizzybees-task-table,
    .bizzybees_page_bizzybees-multi-task .wp-list-table,
    .bizzybees-multi-task .bizzybees-task-table,
    #wpbody-content .bizzybees-task-table {
        display: block !important;
        width: 100% !important;
        overflow-x: scroll !important;
        -webkit-overflow-scrolling: touch !important;
        max-width: 100vw !important;
        table-layout: auto !important;
        white-space: nowrap !important;
        position: relative !important;
        z-index: 1 !important;
    }
    
    /* Force child elements to display properly */
    .bizzybees_page_bizzybees-multi-task .bizzybees-task-table tbody,
    .bizzybees_page_bizzybees-multi-task .bizzybees-task-table thead,
    .bizzybees_page_bizzybees-multi-task .bizzybees-task-table tr {
        display: table-row-group !important;
        width: auto !important;
    }
    
    .bizzybees_page_bizzybees-multi-task .bizzybees-task-table tr {
        display: table-row !important;
        width: auto !important;
    }
    
    .bizzybees_page_bizzybees-multi-task .bizzybees-task-table th,
    .bizzybees_page_bizzybees-multi-task .bizzybees-task-table td {
        display: table-cell !important;
        width: auto !important;
        min-width: 100px !important;
    }
    
    /* Scrollability indicator */
    .bizzybees-panel:after {
        content: "← Swipe to see more →";
        display: block;
        text-align: center;
        font-size: 12px;
        color: #666;
        padding: 5px;
        margin-top: 5px;
        background: #f9f9f9;
        border-radius: 0 0 4px 4px;
    }
    
    /* Action button column */
    .bizzybees_page_bizzybees-multi-task .column-actions {
        min-width: 200px !important;
    }
    
    /* Ensure buttons are visible */
    .button-primary,
    button[type="submit"],
    input[type="submit"],
    .bizzybees_page_bizzybees-multi-task .button {
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Compact action buttons */
    .task-actions {
        white-space: nowrap;
        display: flex;
        gap: 5px;
    }
    
    .task-actions .button {
        padding: 4px 8px !important;
        font-size: 12px !important;
    }
}
/* Fix for button outline clipping on focus - more targeted approach */
.bizzybees-panel .button,
.bizzybees-panel button.button,
.task-actions .button,
.task-actions button {
  margin-left: 4px !important;
}

/* Make buttons' focus state visible without affecting other elements */
.bizzybees-panel .button:focus,
.bizzybees-panel button.button:focus,
.task-actions .button:focus,
.task-actions button:focus {
  outline: 2px solid var(--bizzybees-primary) !important;
  outline-offset: 2px !important;
  position: relative !important;
  z-index: 1 !important;
}

/* Keep the log viewer's overflow settings intact */
#bizzybees-log-viewer {
  overflow-y: auto !important;
  /* Other properties remain unchanged */
}

/* Target exact button classes used in WordPress admin */
input[type="submit"].button.button-primary:focus,
button.button.button-primary:focus,
.button.button-primary:focus,
input[type="submit"].button:focus,
button.button:focus,
.button:focus {
  outline: 3px solid orange !important; /* Use red for testing visibility */
  outline-offset: 3px !important;
  position: relative !important;
  z-index: 999 !important;
}

/* Add margin to prevent left-clipping */
input[type="submit"].button,
button.button,
.button {
  margin-left: 5px !important;
}
.toplevel_page_bizzybees-settings .button-primary:focus,
.bizzybees_page_bizzybees-logs .button-primary:focus,
.bizzybees_page_bizzybees-multi-task .button-primary:focus {
  outline: none !important;             /* Remove default browser outline */
  box-shadow: none !important;         /* Remove default box-shadow */
  outline: 3px solid orange !important; /* Use your custom orange outline */
  outline-offset: 3px !important;       /* Add space around the outline */
}

/* A reusable class for the info icon + tooltip */
.bizzybees-help-icon {
  position: relative;
  display: inline-block;
  cursor: pointer;
  font-style: normal !important;
  margin-left: 6px; /* add a small gap before/after your label */
}

.bizzybees-help-icon::before {
  /* Use the Dashicons “info” icon */
  font-family: "Dashicons";
  content: "\f348";
  /* Adjust size/color as desired */
  font-size: 18px;
  color: #555;
  vertical-align: middle;
}

/* Tooltip bubble (hidden by default) */
.bizzybees-help-icon::after {
  /* We’ll store tooltip text in a data-* attribute in HTML */
  content: attr(data-tip);
  display: none;  
  position: absolute;
  bottom: 100%;   /* place above icon */
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 13px;
  white-space: nowrap;
  z-index: 9999;
}

/* Show on hover/focus (desktop). For mobile, the user can tap/focus the icon. */
.bizzybees-help-icon:hover::after,
.bizzybees-help-icon:focus::after {
  display: block;
}



