/* FB Middleware Modern Styles - Refined */

:root {
    --fbm-primary: #0073aa;
    --fbm-primary-hover: #005177;
    --fbm-secondary: #f0f0f1;
    --fbm-secondary-hover: #e5e5e5;
    --fbm-success: #46b450;
    --fbm-error: #dc3232;
    --fbm-text: #333;
    --fbm-text-light: #666;
    --fbm-border: #ddd;
    --fbm-shadow: 0 4px 12px rgba(0,0,0,0.1);
    --fbm-radius: 6px;
    --fbm-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    --fbm-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Animations */
@keyframes fbmFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fbmPulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 115, 170, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(0, 115, 170, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 115, 170, 0); }
}

/* Search Widget Styling */
.fbm-domain-search-wrapper {
    font-family: var(--fbm-font-family);
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

.fbm-title {
    text-align: center;
    margin-bottom: 20px;
    color: var(--fbm-text);
}

.fbm-input-group {
    display: flex;
    gap: 10px;
    background: #fff;
    padding: 10px;
    border-radius: 50px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
    border: 1px solid #eee;
    transition: var(--fbm-transition);
}

.fbm-input-group:focus-within {
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    border-color: var(--fbm-primary);
    transform: translateY(-2px);
}

#fbm-domain-input,
#fbm-hosting-domain-search,
#fbm-transfer-domain-input,
#fbm-own-domain-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 15px 20px;
    font-size: 18px;
    outline: none;
    color: var(--fbm-text);
}

.fbm-search-btn {
    border-radius: 50px;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Results Area */
.fbm-results-container {
    margin-top: 20px;
    animation: fbmFadeIn 0.5s ease-out;
}

.fbm-success-box {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.fbm-error-box {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 15px;
    border-radius: 12px;
    text-align: center;
}

/* Validation Styles */
.fbm-input-error {
    border: 1px solid var(--fbm-error) !important;
    box-shadow: 0 0 0 3px rgba(220, 50, 50, 0.1);
}


/* Slide-Out Drawer Styles */
.fbm-modal-content {
    background: #fff;
    width: 80%; /* User requested 80% */
    max-width: none;
    margin: 0;
    border-radius: 0;
    box-shadow: -5px 0 30px rgba(0,0,0,0.15);
    position: fixed; /* Fixed to viewport */
    top: 0;
    right: -100%; /* Start off-screen */
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    max-height: none;
    z-index: 10001;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .fbm-modal-content {
        width: 100%; /* Full width on mobile */
    }
}

/* When modal is open, slide content in */
#fbm-checkout-modal.open .fbm-modal-content {
    right: 0;
}

/* General Utilities */
.fbm-btn {
    background: var(--fbm-primary);
    color: #fff;
    border: none;
    padding: 12px 24px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    border-radius: var(--fbm-radius);
    text-decoration: none;
    transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1.2;
}

.fbm-btn:hover {
    background: var(--fbm-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    color: #fff;
}

.fbm-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.fbm-btn.fbm-secondary {
    background: var(--fbm-secondary);
    color: var(--fbm-primary);
    border: 1px solid var(--fbm-primary);
}

.fbm-btn.fbm-secondary:hover {
    background: var(--fbm-secondary-hover);
}

.fbm-btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.fbm-loader-spinner {
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top: 2px solid #fff;
    width: 14px;
    height: 14px;
    animation: fbm-spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes fbm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fbm-validation-msg {
    margin-top: 10px;
    font-size: 14px;
    min-height: 20px;
}

.fbm-success { color: var(--fbm-success); font-weight: 500; }
.fbm-error { color: var(--fbm-error); font-weight: 500; }

/* Domain Search Widget */
.fbm-domain-search-wrapper {
    max-width: 800px;
    margin: 0 auto;
    font-family: var(--fbm-font-family);
}

.fbm-title {
    text-align: center;
    margin-bottom: 24px;
    color: var(--fbm-text);
}

.fbm-input-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: stretch;
}

.fbm-input-group input,
.fbm-input-group select {
    padding: 12px 16px;
    border: 1px solid var(--fbm-border);
    border-radius: var(--fbm-radius);
    font-size: 16px;
    flex-grow: 1;
    transition: border-color 0.2s ease;
}

.fbm-input-group input:focus,
.fbm-input-group select:focus {
    border-color: var(--fbm-primary);
    outline: none;
}

.fbm-input-group select {
    flex-grow: 0;
    width: auto;
    min-width: 140px;
    cursor: pointer;
}

.fbm-results-container {
    margin-top: 24px;
    background: #fff;
    border: 1px solid var(--fbm-border);
    border-radius: var(--fbm-radius);
    padding: 24px;
    box-shadow: var(--fbm-shadow);
    animation: fbm-fadein 0.4s ease-out;
}

@keyframes fbm-fadein {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fbm-suggestions {
    list-style: none;
    padding: 0;
    margin: 16px 0 0;
    border: 1px solid #eee;
    border-radius: var(--fbm-radius);
    overflow: hidden;
}

.fbm-suggestions li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    background: #fff;
    transition: background 0.2s;
}

.fbm-suggestions li:hover {
    background: #f9f9f9;
}

.fbm-suggestions li:last-child {
    border-bottom: none;
}

.fbm-suggestion-name {
    font-weight: 500;
    color: var(--fbm-text);
}

.fbm-actions-container {
    margin-top: 24px;
    text-align: center;
}

/* Hosting Plans Grid */
.fbm-hosting-plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.fbm-plan-card {
    background: #fff;
    border: 1px solid var(--fbm-border);
    border-radius: 8px;
    padding: 32px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.fbm-plan-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    border-color: var(--fbm-primary);
}

.fbm-plan-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 12px;
    color: var(--fbm-text);
}

.fbm-plan-desc {
    color: var(--fbm-text-light);
    margin-bottom: 24px;
    flex-grow: 1;
    line-height: 1.5;
    font-size: 15px;
}

.fbm-plan-price {
    font-size: 32px;
    font-weight: 800;
    color: var(--fbm-primary);
    margin-bottom: 24px;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
}

.fbm-plan-price span {
    font-size: 16px;
    font-weight: normal;
    color: var(--fbm-text-light);
}

/* Drawer Checkout (Refactored from Modal) */
.fbm-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    /* Opacity handled by jQuery fadeIn/fadeOut */
}

.fbm-modal.open .fbm-modal-content {
    right: 0;
}

.fbm-modal-content {
    background-color: #fff;
    margin: 0;
    padding: 0;
    border-radius: 12px 0 0 12px;
    width: 80%; /* 80% width as requested */
    max-width: none; /* Remove max-width limit */
    box-shadow: -5px 0 30px rgba(0,0,0,0.15);
    position: absolute;
    top: 0;
    right: -100%; /* Start off-screen */
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Clip children to border-radius */
    transition: right 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

@media (max-width: 768px) {
    .fbm-modal-content {
        width: 90%; /* Responsive fallback for mobile */
    }
}

.fbm-modal-header {
    padding: 20px 30px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Adjust Checkout Layout for Drawer Width */
.fbm-checkout-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.fbm-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--fbm-text);
}

.fbm-close {
    color: #999;
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
    padding: 0 8px;
}

.fbm-close:hover {
    color: var(--fbm-text);
}

.fbm-modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1; /* Allow body to grow and scroll */
}

/* Steps Progress */
.fbm-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    position: relative;
    padding: 0 20px;
}

.fbm-steps::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 20px;
    right: 20px;
    height: 2px;
    background: #eee;
    z-index: 0;
    transform: translateY(-50%);
}

.fbm-step {
    background: #fff;
    border: 2px solid #eee;
    color: #ccc;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    position: relative;
    z-index: 1;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    font-size: 14px;
}

.fbm-step.active {
    border-color: var(--fbm-primary);
    background: var(--fbm-primary);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(0, 115, 170, 0.15);
}

.fbm-step.completed {
    border-color: var(--fbm-success);
    background: var(--fbm-success);
    color: #fff;
}


.fbm-section {
    background: #fff;
    border: 1px solid var(--fbm-border);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}

.fbm-section h4 {
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 16px;
    color: var(--fbm-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.fbm-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.fbm-field {
    margin-bottom: 0;
}

.fbm-field.full-width {
    grid-column: 1 / -1;
}

.fbm-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--fbm-text);
}

.fbm-field input, 
.fbm-field select,
.fbm-field textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    transition: all 0.2s;
    height: 48px;
    box-sizing: border-box;
}

.fbm-field input:focus, 
.fbm-field select:focus {
    border-color: var(--fbm-primary);
    box-shadow: 0 0 0 3px rgba(0,115,170,0.1);
    outline: none;
}

/* Sidebar Summary */
.fbm-summary-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    padding: 24px;
    border-radius: 8px;
    position: sticky;
    top: 20px;
}

.fbm-summary-card h4 {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.fbm-actions.vertical {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.fbm-btn.full-width {
    width: 100%;
    justify-content: center;
}

/* Hosting Mini Grid (Modal) */
.fbm-hosting-grid-mini {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.fbm-hosting-card {
    background: #fff;
    border: 1px solid var(--fbm-border);
    border-radius: 8px;
    padding: 24px 20px;
    text-align: center;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-height: 140px;
}

.fbm-hosting-card:hover {
    border-color: var(--fbm-primary);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.fbm-hosting-card h4 {
    margin: 0 0 10px;
    font-size: 18px;
    color: var(--fbm-text);
}

.fbm-hosting-card .price {
    font-size: 20px;
    font-weight: 700;
    color: var(--fbm-primary);
    margin-bottom: 15px;
}

/* Sidebar List */
.fbm-sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.fbm-sidebar-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--fbm-text);
}

.fbm-sidebar-list li.fbm-sub-text {
    margin-top: -8px;
    margin-bottom: 12px;
    color: var(--fbm-text-light);
    font-size: 13px;
    justify-content: flex-start;
}

.fbm-sidebar-list li.fbm-divider {
    border-bottom: 1px solid #eee;
    margin: 15px 0;
    height: 1px;
    padding: 0;
}

.fbm-sidebar-list li.fbm-total {
    font-size: 18px;
    font-weight: 700;
    color: var(--fbm-text);
    margin-top: 5px;
}

/* TOS Styling */
.fbm-tos-label {
    display: flex;
    align-items: flex-start; /* Align top for multi-line text */
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
    color: var(--fbm-text);
    padding: 8px 0;
}

.fbm-tos-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 3px; /* Align with first line of text */
    cursor: pointer;
    accent-color: var(--fbm-primary);
}

.fbm-tos-label a {
    color: #0073aa; /* WordPress Blue */
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.fbm-tos-label a:hover {
    text-decoration: underline;
    color: #005177;
}

/* Payment Dropdown Styling */
.fbm-payment-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--fbm-border);
    border-radius: var(--fbm-radius);
    font-size: 16px;
    background-color: #fff;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.fbm-payment-select:focus {
    border-color: var(--fbm-primary);
    outline: none;
}

.fbm-payment-select option:disabled {
    color: #999;
    background-color: #f5f5f5;
}

/* Responsive Rules */
@media (max-width: 900px) {
    .fbm-checkout-layout {
        grid-template-columns: 1fr;
    }
    
    .fbm-checkout-sidebar {
        order: -1; /* Move summary to top */
        margin-bottom: 24px;
    }
    
    .fbm-summary-card {
        position: static;
    }
}

@media (max-width: 768px) {
    .fbm-hosting-grid-mini {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .fbm-grid-2, 
    .fbm-hosting-grid-mini {
        grid-template-columns: 1fr;
    }
}

/* Legacy Support (if any old styles remain) */
.fbm-cart-summary {
    background: #f9f9f9;
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 24px;
    border: 1px solid #eee;
}

.fbm-cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed #ddd;
    font-size: 15px;
}

.fbm-cart-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.fbm-cart-total {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 18px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid #ddd;
    color: var(--fbm-text);
}

/* Responsive */
@media (max-width: 600px) {
    .fbm-input-group {
        flex-direction: column;
    }
    
    .fbm-input-group select,
    .fbm-btn {
        width: 100%;
    }
    
    .fbm-form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .fbm-modal-content {
        width: 95%;
        margin: 2% auto;
        height: 96vh;
        max-height: none;
        border-radius: 8px;
    }
    
    .fbm-hosting-plans-grid {
        grid-template-columns: 1fr;
    }
}

/* Custom Alert Style */
.fbm-alert {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 4px;
    border: 1px solid red;
    color: red;
    font-weight: 500;
}

/* Override existing alert colors if needed, though the above sets red as base */
.fbm-alert.fbm-success {
    border-color: #bbf7d0;
    color: #166534;
    background: #f0fdf4;
}

.fbm-alert.fbm-warning {
    border-color: #fde68a;
    color: #92400e;
    background: #fffbeb;
}

.fbm-alert.fbm-info {
    border-color: #bfdbfe;
    color: #1e40af;
    background: #eff6ff;
}
