/* Sami AI Assistant Stylesheet */

.sami-floating-btn {
    position: fixed;
    bottom: 20px;
    left: 405px; /* Placed neatly next to the phone simulator */
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(11, 16, 29, 0.9);
    backdrop-filter: blur(12px);
    border: 1.5px solid var(--accent-amber, #ffc400);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5), 0 0 15px rgba(255, 196, 0, 0.25);
    border-radius: 50px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    direction: rtl;
    font-family: 'Tajawal', sans-serif;
    color: #fff;
    font-size: 11.5px;
    font-weight: bold;
}

.sami-floating-btn:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.6), 0 0 25px rgba(255, 196, 0, 0.45);
    border-color: #fff;
}

/* Adjust position if the phone simulator is hidden */
.app-container.phone-hidden .sami-floating-btn {
    left: 25px;
}

.sami-avatar-wrapper {
    position: relative;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #ffc400, #ff9100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 14px;
}

.sami-avatar-wrapper .pulse-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 8px;
    height: 8px;
    background: #00e676;
    border-radius: 50%;
    border: 1.5px solid #0b101d;
    box-shadow: 0 0 8px #00e676;
    animation: sami-pulse 2s infinite;
}

@keyframes sami-pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(0, 230, 118, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(0, 230, 118, 0);
    }
}

/* Sami AI Standalone Page Layout */
.sami-dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.sami-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 20px;
}

@media (max-width: 1366px) {
    .sami-grid {
        grid-template-columns: 1fr;
    }
}

/* Actionable Cards */
.sami-action-card {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.sami-action-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
}

.sami-action-card.alert::before { background: var(--accent-rose, #ff1744); }
.sami-action-card.analysis::before { background: var(--accent-amber, #ffc400); }
.sami-action-card.recommendation::before { background: var(--accent-cyan, #00b0ff); }
.sami-action-card.opportunity::before { background: var(--accent-emerald, #00e676); }

.sami-action-card:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.sami-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}

.sami-card-header .type-tag {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 20px;
    font-weight: bold;
}

.sami-card-header.alert .type-tag { background: rgba(255,23,68,0.15); color: var(--accent-rose); }
.sami-card-header.analysis .type-tag { background: rgba(255,196,0,0.15); color: var(--accent-amber); }
.sami-card-header.recommendation .type-tag { background: rgba(0,176,255,0.15); color: var(--accent-cyan); }
.sami-card-header.opportunity .type-tag { background: rgba(0,230,118,0.15); color: var(--accent-emerald); }

.sami-card-content {
    font-size: 11.5px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.sami-card-impact {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 800;
    color: var(--accent-emerald);
    background: rgba(0, 230, 118, 0.08);
    padding: 4px 8px;
    border-radius: 6px;
    width: fit-content;
}

.sami-card-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 5px;
}

/* Chat Interface Styling */
.sami-chat-panel {
    display: flex;
    flex-direction: column;
    height: 520px;
    background: rgba(15, 23, 42, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
}

.sami-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sami-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.6;
    animation: sami-fade-in 0.25s ease-out;
}

@keyframes sami-fade-in {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.sami-msg.user {
    align-self: flex-start;
    background: rgba(124, 77, 255, 0.15);
    border: 1px solid rgba(124, 77, 255, 0.25);
    color: #fff;
    border-bottom-left-radius: 2px;
}

.sami-msg.assistant {
    align-self: flex-end;
    background: rgba(255, 255, 255, 0.03);
    border: 1.5px solid rgba(255, 196, 0, 0.2);
    color: #f8fafc;
    border-bottom-right-radius: 2px;
}

.sami-msg.assistant .sami-title {
    font-weight: bold;
    color: var(--accent-amber);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sami-msg-actions {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-top: 1px dashed rgba(255,255,255,0.06);
    padding-top: 10px;
}

.sami-chat-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px;
    background: rgba(0,0,0,0.15);
    border-top: 1px solid var(--border-color);
}

.sami-preset-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 10.5px;
    cursor: pointer;
    transition: all 0.2s;
}

.sami-preset-btn:hover {
    background: rgba(255, 196, 0, 0.1);
    border-color: var(--accent-amber);
    color: #fff;
}

.sami-chat-input-area {
    display: flex;
    padding: 12px;
    background: rgba(0,0,0,0.2);
    border-top: 1px solid var(--border-color);
    gap: 10px;
}

.sami-chat-input {
    flex: 1;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    color: #fff;
    font-size: 12px;
    outline: none;
}

.sami-chat-input:focus {
    border-color: var(--accent-amber);
}

.sami-chat-send-btn {
    background: var(--accent-amber);
    border: none;
    color: #000;
    border-radius: 8px;
    padding: 0 16px;
    font-weight: bold;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.sami-chat-send-btn:hover {
    background: #ffb300;
}

/* Tabs & Unified Dashboard Layout Extensions */
.sami-tab-btn {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-family: 'Tajawal', sans-serif;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sami-tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.sami-tab-btn.active {
    background: rgba(255, 196, 0, 0.08);
    color: var(--accent-amber);
    border-color: var(--accent-amber);
    box-shadow: 0 0 10px rgba(255, 196, 0, 0.1);
}

.sami-tab-content {
    display: none;
    animation: sami-tab-fade 0.3s ease-out;
}

.sami-tab-content.active {
    display: flex;
}

@keyframes sami-tab-fade {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Progress bar inside Profit Leakage breakdown */
.leak-progress-container {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    height: 6px;
    border-radius: 4px;
    margin-top: 8px;
    overflow: hidden;
}

.leak-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease-in-out;
}

/* Specific Leakage Colors */
.leak-fill-waste { background: var(--accent-rose); }
.leak-fill-churn { background: var(--accent-amber); }
.leak-fill-stagnant { background: var(--accent-indigo); }
.leak-fill-branches { background: var(--accent-cyan); }
.leak-fill-labor { background: var(--accent-emerald); }

.sami-leak-row {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    transition: all 0.2s;
}

.sami-leak-row:hover {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255,255,255,0.08);
}

