/* =======================================================
   Rigel Forms - Form Builder Dashboard Styles
======================================================= */
.rigel-flex-row { display: flex; gap: 20px; margin-top: 15px; }
.rigel-flex-2 { flex: 2; }
.rigel-flex-1 { flex: 1; }
.rigel-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }

.rigel-tag-btn-group { margin-bottom: 10px; display: flex; gap: 5px; flex-wrap: wrap; }
.rigel-code-input { width: 100%; font-family: monospace; padding: 10px; background: #f0f0f1; border: 1px solid #ccc; }
.rigel-readonly-embed { width: 100%; text-align: center; font-family: monospace; cursor: pointer; background: #f0f0f1; padding: 10px; border: 1px solid #ccc; }

.rigel-html-warning { color: #721c24; background-color: #f8d7da; padding: 10px; margin-bottom: 10px; border: 1px solid #f5c6cb; border-radius: 4px; display: none; line-height: 1.5; }

.rigel-enquiry-panel { background: #f0f0f1; border: 1px solid #c3c4c7; padding: 20px; border-radius: 4px; font-size: 15px; line-height: 1.6; }
.rigel-enquiry-panel h3 { margin-top: 0; padding-bottom: 10px; border-bottom: 1px solid #ddd; font-size: 18px; }

/* =======================================================
   Template Library Modal Overlay
======================================================= */
#rigel-template-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(16, 21, 23, 0.85); /* Dark overlay */
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    padding: 40px 20px;
}

.rigel-template-container {
    background: #f6f7f7;
    width: 100%;
    max-width: 1000px;
    border-radius: 4px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.rigel-template-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 2px solid #e2e4e7;
    padding-bottom: 15px;
}

.rigel-template-header h2 { margin: 0; font-size: 22px; color: #1d2327; }

.rigel-template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.rigel-template-card {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 30px 20px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.rigel-template-card:hover {
    border-color: #ff7a59;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transform: translateY(-2px);
}

.rigel-template-card .dashicons {
    font-size: 36px;
    width: 36px; height: 36px;
    color: #ff7a59; /* Matching the orange from your screenshot */
    margin-bottom: 15px;
}

.rigel-template-card h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #1d2327;
}

.rigel-template-card p {
    margin: 0;
    font-size: 13px;
    color: #646970;
    line-height: 1.5;
}

/* =======================================================
   Integration Settings - Big Box UI
======================================================= */
.rigel-integrations-wrapper {
    max-width: 1000px;
    margin-top: 20px;
}

.rigel-integrations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
    margin-top: 25px;
    margin-bottom: 25px;
}

.rigel-integration-card {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    overflow: hidden;
}

.rigel-integration-header {
    padding: 20px;
    border-bottom: 1px solid #e2e4e7;
    display: flex;
    align-items: center;
    gap: 15px;
    background: #fff;
}

.rigel-integration-icon {
    font-size: 32px;
    width: 32px;
    height: 32px;
    color: #2271b1; /* WordPress Blue */
}

.rigel-integration-header-text {
    flex-grow: 1;
}

.rigel-integration-header-text h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    color: #1d2327;
}

.rigel-integration-header-text p {
    margin: 0;
    color: #646970;
    font-size: 13px;
    line-height: 1.4;
}

.rigel-status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rigel-status-active { background: #d1e7dd; color: #0f5132; border: 1px solid #badbcc; }
.rigel-status-inactive { background: #f8d7da; color: #842029; border: 1px solid #f5c2c7; }

.rigel-integration-body {
    padding: 20px;
    background: #f6f7f7; /* Very light gray inside the box */
    flex-grow: 1;
}

.rigel-integration-input-group {
    margin-bottom: 15px;
}

.rigel-integration-input-group:last-child {
    margin-bottom: 0;
}

.rigel-integration-input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #2c3338;
}

.rigel-integration-input-group input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #8c8f94;
    box-sizing: border-box;
    max-width: none;
}


/* =======================================================
   Modern Form Builder UI Upgrades
======================================================= */

/* 1. Dark Mode Code Editor */
#rigel_form_html_area {
    background-color: #1e1e1e;
    color: #d4d4d4;
    border-radius: 6px;
    padding: 16px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    border: 1px solid #2d2d2d;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
    transition: border-color 0.2s;
}
#rigel_form_html_area:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2), 0 0 0 1px #2271b1;
}

/* 2. Interactive Pill Buttons for HTML Tags */
.rigel-tag-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}
.rigel-tag-btn-group .rigel-insert-tag {
    background: #f0f0f1 !important;
    border: 1px solid #8c8f94 !important;
    border-radius: 20px !important;
    padding: 4px 16px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #3c434a !important;
    cursor: pointer;
    transition: all 0.2s ease !important;
    box-shadow: none !important;
}
.rigel-tag-btn-group .rigel-insert-tag:hover {
    background: #2271b1 !important;
    color: #fff !important;
    border-color: #2271b1 !important;
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(34, 113, 177, 0.2) !important;
}

/* 3. Click-to-Copy Zones (Shortcode / Iframe) */
.rigel-readonly-embed {
    background: #f6f7f7;
    border: 2px dashed #c3c4c7;
    border-radius: 6px;
    color: #d63638;
    font-weight: 600;
    text-align: center;
    padding: 6px !important;
    transition: all 0.2s ease;
    font-size: 14px;
}
.rigel-readonly-embed:hover {
    background: #f0f6fc;
    border-color: #2271b1;
    color: #2271b1;
    cursor: copy;
}

/* 4. Modern Inputs & Selects */
.rigel-flex-row input[type="text"],
.rigel-flex-row input[type="email"],
.rigel-flex-row input[type="url"],
.rigel-flex-row select,
.rigel-flex-row textarea:not(#rigel_form_html_area),
.rigel-grid-2 input[type="text"],
.rigel-grid-2 input[type="url"],
.rigel-grid-2 select,
.rigel-grid-2 textarea {
    border-radius: 4px;
    border: 1px solid #8c8f94;
    padding: 6px 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}
.rigel-flex-row input:focus,
.rigel-flex-row select:focus,
.rigel-flex-row textarea:focus,
.rigel-grid-2 input:focus,
.rigel-grid-2 select:focus,
.rigel-grid-2 textarea:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

/* 5. Clean up the Sidebar Settings Card */
.rigel-admin-card {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.rigel-admin-card h4 {
    margin-top: 0;
    color: #1d2327;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e2e4e7;
    padding-bottom: 8px;
    margin-bottom: 15px;
}

/* =======================================================
   Visual Styling Tab Enhancements
======================================================= */
.rigel-style-group {
    margin-bottom: 18px;
}
.rigel-style-group label {
    display: inline-block;
    margin-bottom: 6px;
    color: #2c3338;
}

/* Apply Dark Mode Code Editor style to Custom CSS / JS boxes */
textarea.rigel-code-input {
    background-color: #1e1e1e;
    color: #d4d4d4;
    border-radius: 6px;
    padding: 12px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    border: 1px solid #2d2d2d;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
    transition: border-color 0.2s;
    width: 100%;
    box-sizing: border-box;
}
textarea.rigel-code-input:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2), 0 0 0 1px #2271b1;
}

/* Tweak the WP Color Picker layout so it fits perfectly */
.wp-picker-container {
    display: inline-block;
}
.rigel-style-group input[type="text"]:not(.wp-color-picker) {
    width: 100%;
    max-width: 250px;
}


/* =======================================================
   Mail & Submission Action UI Polish
======================================================= */
#form_mail_meta_box input[type="text"],
#form_mail_meta_box textarea:not(.rigel-code-input),
#form_submission_meta_box input[type="text"],
#form_submission_meta_box input[type="url"],
#form_submission_meta_box select,
#form_submission_meta_box textarea {
    border-radius: 4px;
    border: 1px solid #8c8f94;
    padding: 8px 12px;
    transition: all 0.2s ease;
    background: #fff;
    width: 100%;
    box-sizing: border-box;
    font-size: 13px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

#form_mail_meta_box input[type="text"]:focus,
#form_mail_meta_box textarea:not(.rigel-code-input):focus,
#form_submission_meta_box input[type="text"]:focus,
#form_submission_meta_box input[type="url"]:focus,
#form_submission_meta_box select:focus,
#form_submission_meta_box textarea:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

/* Space out the Submission Actions panel */
.rigel-submission-panel {
    padding: 10px;
}
.rigel-submission-group {
    margin-bottom: 22px;
}

/* =======================================================
   All Forms Dashboard - Table Redesign
======================================================= */

/* Redesign the Table Header */
body.post-type-multi_tier_form .wp-list-table {
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border-radius: 8px;
    overflow: hidden;
    border-collapse: separate;
    border-spacing: 0;
}

body.post-type-multi_tier_form .wp-list-table thead th a:hover {
    color: #72aee6;
}

/* Row Hover Effects */
body.post-type-multi_tier_form .wp-list-table tbody tr {
    background: #ffffff;
    transition: all 0.2s ease;
}
body.post-type-multi_tier_form .wp-list-table tbody tr:hover {
    background: #f8fbfe;
    box-shadow: inset 4px 0 0 #2271b1; /* Blue strip on hover */
}
body.post-type-multi_tier_form .wp-list-table td {
    padding: 15px;
    vertical-align: middle;
    border-bottom: 1px solid #f0f0f1;
}

/* Modern Interactive Copy Boxes */
.rigel-copy-box {
    position: relative;
    max-width: 320px;
}
.rigel-copy-box input.rigel-readonly-embed {
    width: 100%;
    padding: 8px 35px 8px 12px !important; /* Make room for icon */
    cursor: pointer;
    background: #f6f7f7;
    border: 1px solid #dcdcdc;
    border-radius: 4px;
    color: #50575e;
    font-family: monospace;
    font-size: 13px;
    box-shadow: none;
    text-align: left;
    transition: all 0.2s ease;
}
.rigel-copy-box input.rigel-readonly-embed:hover {
    background: #ffffff;
    border-color: #2271b1;
    color: #2271b1;
}
.rigel-copy-box .dashicons {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #a7aaad;
    pointer-events: none; /* Let clicks pass through to input */
    transition: color 0.2s ease;
}
.rigel-copy-box:hover .dashicons {
    color: #2271b1;
}

/* Dynamic Submission Badges */
.rigel-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 13px;
}
.rigel-badge-success { 
    background: #e5f5fa; 
    color: #0070a0; 
    border: 1px solid #bce1ee; 
}
.rigel-badge-empty { 
    background: #f0f0f1; 
    color: #646970; 
    border: 1px solid #c3c4c7; 
}
.rigel-count-badge .dashicons { 
    font-size: 16px; 
    width: 16px; 
    height: 16px; 
}

/* =======================================================
   All Forms Dashboard - Column Alignment Fixes
======================================================= */

/* 1. Define specific widths for each column so they don't fight for space */
body.post-type-multi_tier_form .wp-list-table .column-title { 
    width: 20%; 
}
body.post-type-multi_tier_form .wp-list-table .column-shortcode { 
    width: 28%; 
}
body.post-type-multi_tier_form .wp-list-table .column-iframe { 
    width: 28%; 
}
body.post-type-multi_tier_form .wp-list-table .column-submissions { 
    width: 12%; 
    text-align: center; /* Center the header and the badge */
}
body.post-type-multi_tier_form .wp-list-table .column-date { 
    width: 12%; 
}

/* 2. Center the Submissions Header text to match the badge */
body.post-type-multi_tier_form .wp-list-table th.column-submissions {
    text-align: center !important;
}

/* 3. Ensure the Copy Boxes don't overflow out of their columns */
.rigel-copy-box {
    width: 100%;
    max-width: 100%; /* Allows it to comfortably fill its 28% column space */
}

/* 4. Vertically center all text inside the rows for a perfectly straight line */
body.post-type-multi_tier_form .wp-list-table td {
    vertical-align: middle !important;
}

/* 5. Fix Checkbox Vertical Alignment */
body.post-type-multi_tier_form .wp-list-table th.check-column,
body.post-type-multi_tier_form .wp-list-table td.check-column {
    vertical-align: middle !important;
    padding-top: 15px !important; /* Matches our new row padding */
    padding-bottom: 15px !important;
    padding-left: 15px !important;
}

body.post-type-multi_tier_form .wp-list-table .check-column input[type="checkbox"] {
    margin: 0 !important; /* Strips the default WordPress top-margin */
    vertical-align: middle !important;
    position: relative;
    top: -1px; /* Tiny optical adjustment to align perfectly with the title text */
}


/* =======================================================
   Enquiries Dashboard UI Polish
======================================================= */

/* Apply the dark header and hover effects to the Enquiries table */
body.post-type-rigel_enquiry .wp-list-table {
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border-radius: 8px;
    overflow: hidden;
    border-collapse: separate;
    border-spacing: 0;
}
body.post-type-rigel_enquiry .wp-list-table thead th,
body.post-type-rigel_enquiry .wp-list-table tfoot th {
    background: #1d2327;
    color: #ffffff;
    border: none;
    padding: 15px;
    font-weight: 600;
}
body.post-type-rigel_enquiry .wp-list-table thead th a,
body.post-type-rigel_enquiry .wp-list-table tfoot th a { color: #ffffff; }
body.post-type-rigel_enquiry .wp-list-table thead th a:hover { color: #72aee6; }
body.post-type-rigel_enquiry .wp-list-table tbody tr { background: #ffffff; transition: all 0.2s ease; }
body.post-type-rigel_enquiry .wp-list-table tbody tr:hover {
    background: #f8fbfe;
    box-shadow: inset 4px 0 0 #2271b1;
}
body.post-type-rigel_enquiry .wp-list-table td {
    padding: 15px;
    vertical-align: middle;
    border-bottom: 1px solid #f0f0f1;
}

/* Interactive Email Link */
.rigel-email-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: #2271b1;
    font-weight: 500;
    transition: all 0.2s ease;
}
.rigel-email-link:hover { 
    color: #135e96; 
}
.rigel-email-link .dashicons { 
    font-size: 16px; 
    width: 16px; 
    height: 16px; 
    color: #a7aaad; 
    transition: color 0.2s ease;
}
.rigel-email-link:hover .dashicons { 
    color: #2271b1; 
}

/* Form Used Pill Badge */
.rigel-form-badge {
    background: #f0f0f1;
    color: #3c434a;
    border: 1px solid #c3c4c7;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-block;
}
.rigel-form-badge:hover {
    background: #e5f5fa;
    color: #0070a0;
    border-color: #bce1ee;
    transform: translateY(-1px);
}


/* Hide standard WP elements on Enquiry View to make it look like a real app */
.post-type-rigel_enquiry #poststuff #post-body.columns-2 #postbox-container-1,
.post-type-rigel_enquiry #screen-meta-links,
.post-type-rigel_enquiry #titlediv,
.post-type-rigel_enquiry .postbox-container #enquiry_read_only_box {
    display: none !important;
}

.post-type-rigel_enquiry #post-body-content {
    float: none !important;
    width: 100% !important;
}

/* New Modern Card Styling */
.rigel-enquiry-full-view {
    margin-top: 30px;
    max-width: 900px;
}

.rigel-enquiry-card {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden;
}

.rigel-card-header {
    padding: 30px;
    background: #f8fbfe;
    border-bottom: 1px solid #e2e4e7;
}

.rigel-card-header h1 {
    margin: 0 0 5px 0 !important;
    font-size: 26px;
    color: #1d2327;
}

.rigel-card-header p {
    margin: 0;
    color: #646970;
    font-size: 14px;
}

.rigel-card-body {
    padding: 40px;
    font-size: 16px;
    line-height: 1.6;
}

/* Styling the labels inside the content */
.rigel-inner-grid strong {
    display: inline-block;
    width: 120px;
    color: #1d2327;
    font-weight: 700;
}

.rigel-card-footer {
    padding: 20px 40px;
    background: #f6f7f7;
    border-top: 1px solid #e2e4e7;
}

.rigel-reply-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #2271b1;
    color: #fff;
    padding: 12px 25px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s;
}

.rigel-reply-btn:hover {
    background: #135e96;
    color: #fff;
}

.rigel-reply-btn .dashicons {
    font-size: 18px;
}



@media screen and (max-width:768px){
    .rigel-flex-row {
        flex-direction: column;
    }

    .rigel-grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.rigel-style-group {
    margin-bottom: 20px;
    display: block;
}

/* 1. Remove the rigid desktop widths so the Title takes full space */
    body.post-type-multi_tier_form .wp-list-table .column-title,
    body.post-type-multi_tier_form .wp-list-table .column-shortcode,
    body.post-type-multi_tier_form .wp-list-table .column-iframe,
    body.post-type-multi_tier_form .wp-list-table .column-submissions,
    body.post-type-multi_tier_form .wp-list-table .column-date { 
        width: auto !important; 
    }

    /* 2. Reset the checkbox padding for mobile */
    body.post-type-multi_tier_form .wp-list-table th.check-column, 
    body.post-type-multi_tier_form .wp-list-table td.check-column {
        padding: 11px 10px !important;
    }

    /* 3. Align the Submissions badge to the left when the row drops down */
    body.post-type-multi_tier_form .wp-list-table .column-submissions,
    body.post-type-multi_tier_form .wp-list-table th.column-submissions { 
        text-align: left !important; 
    }

    /* 4. Ensure copy boxes fit perfectly inside the toggled mobile view */
    .rigel-copy-box input.rigel-readonly-embed {
        font-size: 12px;
        padding: 10px 35px 10px 10px !important;
    }
}