/* /business/css/components.css */

/* --- Layout --- */
.builder-layout {
    display: flex;
    gap: 30px;
    /* Use min-height instead of fixed height to prevent cutting off */
    min-height: 800px;
    align-items: stretch;
}

/* --- Intro Banner (Updated to Corporate Style) --- */
.builder-intro-banner {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border-radius: var(--border-radius);
    padding: 20px 25px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 25px;
    box-shadow: var(--box-shadow);
}

.intro-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.intro-icon {
    font-size: 24px;
    background: #eaf3fb;
    color: var(--primary-color);
    width: 50px; height: 50px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.intro-text h3 { margin: 0 0 5px 0; font-size: 18px; color: white; }
.intro-text p { margin: 0; font-size: 14px; opacity: 0.9; line-height: 1.4; }

.intro-actions .btn-secondary {
    font-size: 13px;
    padding: 8px 16px;
    white-space: nowrap;
}


/* --- Library Column --- */
.component-library {
    width: 340px;
    flex-shrink: 0;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    max-height: 800px; /* Constrain height but allow scroll */
}

.lib-header {
    padding: 20px 20px 15px 20px;
    border-bottom: 1px solid var(--border-color);
    background: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}
.component-library h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--text-dark); }

.component-list-container {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
    /* Custom Scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.lib-category-label {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
    color: #94a3b8; font-weight: 700; margin-bottom: 12px;
}
.lib-category-label.core-label { margin-top: 30px; }

.component-card {
    display: flex; align-items: center; gap: 15px; padding: 16px;
    border: 1px solid var(--border-color); border-radius: 8px;
    margin-bottom: 12px; background: white;
    transition: all 0.2s ease;
}
.component-card:not(.locked):hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transform: translateY(-2px);
}
.component-card.locked {
    background: #f8fafc; opacity: 0.8; pointer-events: none; border-style: dashed;
}

.component-card .card-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
}
.event-icon { background: #eafaf1; color: #2ecc71; }
.wallet-icon { background: #eaf3fb; color: #3498db; }
.link-icon   { background: #fef9e7; color: #f1c40f; }
.feed-icon   { background: #f3f0ff; color: #9b59b6; }
.story-icon  { background: #fff0f6; color: #e91e63; }

.component-card .card-details { flex-grow: 1; min-width: 0; }
.card-details h4 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-details p { margin: 4px 0 0 0; font-size: 12px; color: #64748b; line-height: 1.3; }

/* Add Button Styling */
.btn-add-component {
    border: 1px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    border-radius: 6px; padding: 8px 12px; font-size: 12px; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; gap: 6px;
    transition: all 0.2s ease;
    min-width: 80px;
    justify-content: center;
}
.btn-add-component:hover {
    background: var(--primary-color);
    color: white;
}
/* State: Added */
.btn-add-component.added {
    background: #eafaf1;
    border-color: #eafaf1;
    color: #2ecc71;
    cursor: default;
    pointer-events: none; /* Disable clicks */
}

.component-card.locked .status-text {
    font-size: 11px; color: #94a3b8; font-weight: 500; display: flex; align-items: center; gap: 5px;
}


/* --- Visual Composer (Right Side) --- */
.visual-composer {
    flex-grow: 1;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid var(--border-color);
    position: relative;
    /* Ensure height fits content */
    padding-bottom: 20px;
}
.composer-header {
    width: 100%; display: flex; justify-content: space-between; align-items: center;
    padding: 20px; border-bottom: 1px solid var(--border-color);
    background: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}
.composer-header h4 { margin: 0; color: var(--text-dark); font-size: 16px; font-weight: 700; }
.live-indicator {
    font-size: 12px; color: #2ecc71; font-weight: 600; display: flex; align-items: center; gap: 6px;
    background: #eafaf1; padding: 6px 12px; border-radius: 20px;
}
.live-indicator .dot { width: 8px; height: 8px; background: #2ecc71; border-radius: 50%; box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.2); animation: pulse 2s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }

/* Wrapper to hold the phone - Center and Contain */
.device-frame-wrapper {
    flex-grow: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px; /* Add breathing room around phone */
    overflow: visible; /* Don't clip shadows */
}

/* REALISTIC PHONE STYLES */
.device-mockup {
    width: 320px;
    height: 650px;
    background: #1e293b;
    border-radius: 48px;
    padding: 12px;
    position: relative;
    box-shadow: 0 30px 60px rgba(0,0,0,0.3), inset 0 0 0 2px #334155;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}
.device-notch {
    position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 120px; height: 28px; background: #1e293b;
    border-bottom-left-radius: 16px; border-bottom-right-radius: 16px; z-index: 10;
}
.device-volume-btn {
    position: absolute; left: -3px; top: 110px; width: 3px; height: 50px; background: #334155; border-radius: 2px 0 0 2px;
}
.device-power-btn {
    position: absolute; right: -3px; top: 150px; width: 3px; height: 40px; background: #334155; border-radius: 0 2px 2px 0;
}

.device-screen {
    background: #f0f2f5; width: 100%; height: 100%;
    border-radius: 36px; overflow: hidden;
    display: flex; flex-direction: column;
    position: relative;
    font-family: 'Roboto', sans-serif;
    /* Text align handling for RTL/LTR handled in JS via dir attribute */
}

/* FAKE APP UI */
.app-header-fake {
    height: 80px; background: white; border-bottom: 1px solid rgba(0,0,0,0.05);
    padding: 35px 20px 10px 20px; /* Top pad for notch */
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;
}
.fake-logo-img { height: 28px; width: auto; }
.fake-header-right { display: flex; gap: 10px; align-items: center; }
.fake-icon { color: #536471; font-size: 16px; }
.fake-avatar { width: 30px; height: 30px; border-radius: 50%; background: #ccc; background-image: url('https://i.pravatar.cc/100?img=12'); background-size: cover; }

.app-body-content {
    flex-grow: 1; overflow-y: auto; padding: 15px;
    display: flex; flex-direction: column; gap: 15px;
    scrollbar-width: none;
}
.app-body-content::-webkit-scrollbar { display: none; }

/* Real-looking Widgets inside Phone */
.app-widget-block {
    background: white; border-radius: 16px; padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

/* Stories (Fixed) */
.stories-block {
    padding: 10px; display: flex; gap: 12px; overflow: hidden; height: 75px; align-items: center;
}
.story-circle {
    width: 52px; height: 52px; border-radius: 50%; background-color: #eee;
    background-size: cover; border: 2px solid white; box-shadow: 0 0 0 1px #e2e8f0; flex-shrink: 0;
}
.story-circle.add {
    border: 2px dashed #3498db; background: none; color: #3498db;
    display: flex; align-items: center; justify-content: center; font-size: 18px; box-shadow: none;
}

/* Feed (Fixed) */
.feed-block { display: flex; flex-direction: column; gap: 10px; }
.feed-header { display: flex; gap: 10px; align-items: center; }
.feed-avatar { width: 32px; height: 32px; border-radius: 50%; background-image: url('https://i.pravatar.cc/100?img=12'); background-size: cover; }
.feed-input { background: #f0f2f5; border-radius: 20px; padding: 8px 12px; font-size: 13px; color: #64748b; flex-grow: 1; }
.feed-actions { border-top: 1px solid #f0f2f5; padding-top: 10px; display: flex; justify-content: space-around; }
.feed-actions span { font-size: 12px; color: #64748b; font-weight: 500; display: flex; align-items: center; gap: 6px; }

/* DYNAMIC WIDGET STYLES (Real Looking) */
.dynamic-widget {
    background: white; border-radius: 16px; padding: 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    overflow: hidden;
    position: relative;
    border: 1px solid #f1f5f9;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes popIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Remove button */
.dynamic-widget .remove-widget-btn {
    position: absolute; top: 8px;
    inset-inline-end: 8px; /* Logical property for RTL */
    background: rgba(239, 68, 68, 0.1); color: #ef4444; border: none;
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; opacity: 0; transition: all 0.2s ease;
    z-index: 5; font-size: 12px;
}
.dynamic-widget:hover .remove-widget-btn { opacity: 1; }
.dynamic-widget .remove-widget-btn:hover { background: #ef4444; color: white; }

/* Event Widget Style */
.widget-event-content { display: flex; padding: 15px; gap: 15px; align-items: center; }
.widget-date-box { display: flex; flex-direction: column; align-items: center; color: #1877F2; line-height: 1; }
.widget-date-box span { font-size: 10px; font-weight: 700; letter-spacing: 0.5px; }
.widget-date-box strong { font-size: 20px; }
.widget-info { flex-grow: 1; }
.widget-info h5 { margin: 0; font-size: 14px; font-weight: 600; color: #0F1419; }
.widget-info p { margin: 2px 0 0 0; font-size: 12px; color: #536471; }
.widget-btn-sm {
    background: #eafaf1; color: #2ecc71; border: none;
    border-radius: 6px; padding: 6px 12px; font-size: 11px; font-weight: 600;
}

/* Wallet Widget Style */
.widget-wallet-content { padding: 15px; }
.wallet-row-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.wallet-title { font-size: 11px; font-weight: 700; color: #3498db; text-transform: uppercase; }
.wallet-amt { font-size: 24px; font-weight: 700; color: #0F1419; }
.wallet-sub { font-size: 11px; color: #536471; }

/* Links Widget Style */
.widget-links-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: #f0f2f5; }
.link-item { background: white; padding: 15px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.link-item i { font-size: 18px; color: #f1c40f; }
.link-item span { font-size: 11px; font-weight: 500; color: #0F1419; }


/* Empty State */
.empty-state-placeholder {
    border: 2px dashed #cbd5e1; border-radius: 12px;
    padding: 20px; text-align: center;
    color: #94a3b8; font-size: 12px; font-weight: 500;
    margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 10px;
}
/* Flip arrow on RTL */
[dir="rtl"] .arrow-indicator { transform: scaleX(-1); }

/* Nav Fake */
.app-nav-fake {
    height: 60px; background: white; border-top: 1px solid rgba(0,0,0,0.05);
    display: flex; justify-content: space-around; align-items: center;
    flex-shrink: 0;
}
.nav-item { color: #94a3b8; font-size: 20px; }
.nav-item.active { color: #1877F2; }

/* Footer */
.composer-footer {
    width: 100%; max-width: 320px; margin-top: 10px; padding-bottom: 10px;
}
.btn-publish {
    width: 100%; padding: 14px; background: var(--text-dark); color: white;
    border: none; border-radius: 8px; font-size: 14px; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.btn-publish:hover { background: black; transform: translateY(-2px); }

/* Mobile Response */
@media (max-width: 991px) {
    .builder-layout { flex-direction: column; height: auto; }
    .component-library { width: 100%; max-height: none; border: none; box-shadow: none; padding: 0; margin-bottom: 20px; }
    .visual-composer { min-height: 750px; }
    .device-mockup { width: 280px; height: 580px; } /* Slightly smaller on tablet/mobile */
}