/* --- Module-Specific Styles --- */

/* ==========================================================================
   1. Dashboard & Core Layout Shell
   ========================================================================== */
.bos-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.bos-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    transition: var(--transition-smooth);
}
.bos-sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}
.sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 0.75rem;
    border-bottom: 1px solid var(--glass-border);
}
.sidebar-logo {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-gold) 0%, #9e7d23 100%);
    border-radius: 8px;
    color: #060f26;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    box-shadow: 0 0 10px rgba(201, 168, 76, 0.4);
    flex-shrink: 0;
}
.brand-name {
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff 0%, var(--accent-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: var(--transition-smooth);
}
.bos-sidebar.collapsed .brand-name {
    opacity: 0;
    pointer-events: none;
    width: 0;
}
.sidebar-menu {
    list-style: none;
    padding: 1.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow-y: auto;
    flex-grow: 1;
}
.menu-item a {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition-smooth);
}
.menu-item a i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}
.menu-item a:hover, .menu-item.active a {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}
.menu-item.active a {
    background: linear-gradient(90deg, rgba(201, 168, 76, 0.15) 0%, transparent 100%);
    border-left: 3px solid var(--accent-gold);
    color: var(--accent-gold);
}
.bos-sidebar.collapsed .menu-item span {
    opacity: 0;
    width: 0;
    display: none;
}
.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid var(--glass-border);
}

/* User Card in Sidebar */
.user-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(201, 168, 76, 0.2);
    border: 1px solid var(--accent-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-gold);
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.user-info {
    overflow: hidden;
    transition: var(--transition-smooth);
}
.user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}
.user-role {
    font-size: 0.6875rem;
    color: var(--accent-gold);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.03em;
}
.bos-sidebar.collapsed .user-info {
    opacity: 0;
    width: 0;
    display: none;
}

/* Main Area Layout */
.main-area {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition-smooth);
}
.main-area.expanded {
    margin-left: var(--sidebar-collapsed-width);
}

/* Topbar */
.bos-topbar {
    height: var(--topbar-height);
    border-bottom: 1px solid var(--glass-border);
    background: rgba(6, 15, 38, 0.45);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.sidebar-toggle:hover {
    color: var(--accent-gold);
}
.topbar-search {
    position: relative;
    max-width: 300px;
}
.topbar-search i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.topbar-search input {
    padding-left: 2.2rem;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
.company-badge {
    background: rgba(201, 168, 76, 0.1);
    border: 1px solid rgba(201, 168, 76, 0.2);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--accent-gold);
}
.notification-bell {
    position: relative;
    font-size: 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
}
.notification-bell:hover {
    color: var(--accent-gold);
}
.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 8px;
    height: 8px;
    background-color: var(--color-danger);
    border-radius: 50%;
}

/* Page Container */
.page-container {
    padding: 2rem;
    flex-grow: 1;
    overflow-y: auto;
}
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Metric Cards */
.metric-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.metric-info h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}
.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    margin-bottom: 0.25rem;
}
.metric-trend {
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.metric-trend.up { color: var(--color-success); }
.metric-trend.down { color: var(--color-danger); }
.metric-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-gold);
    font-size: 1.25rem;
}

/* Recent Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.activity-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.activity-details {
    flex-grow: 1;
}
.activity-text {
    font-size: 0.8125rem;
    color: var(--text-primary);
}
.activity-text strong {
    font-weight: 600;
}
.activity-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Onboarding / Register Card */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    z-index: 10;
}
.auth-card {
    width: 100%;
    max-width: 480px;
}
.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}
.auth-title {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 0%, var(--accent-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-top: 0.75rem;
}
.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* ==========================================================================
   2. CRM Module
   ========================================================================== */

/* Kanban Board Layout */
.pipeline-container {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    min-height: 500px;
    align-items: flex-start;
}
.pipeline-column {
    flex: 0 0 280px;
    background: rgba(6, 15, 38, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 200px);
}
.pipeline-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
}
.pipeline-column-title {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.pipeline-column-count {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.pipeline-cards-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    flex-grow: 1;
    min-height: 150px;
}
.deal-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 0.875rem;
    cursor: grab;
    transition: var(--transition-smooth);
}
.deal-card:hover {
    background: rgba(255, 255, 255, 0.02);
    border-color: var(--accent-gold);
    transform: translateY(-2px);
}
.deal-card:active {
    cursor: grabbing;
}
.deal-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.deal-company {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}
.deal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.deal-value {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--accent-gold);
}

/* ==========================================================================
   3. Finance Module
   ========================================================================== */
.invoice-creator-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}
.invoice-preview-container {
    position: sticky;
    top: 90px;
}
.item-row {
    display: grid;
    grid-template-columns: 3fr 1fr 1.5fr 1fr;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.currency-selector-badge {
    cursor: pointer;
    transition: var(--transition-smooth);
}
.currency-selector-badge:hover, .currency-selector-badge.active {
    background: var(--accent-gold);
    color: #060f26;
    border-color: var(--accent-gold);
}

/* ==========================================================================
   4. Inventory Module & HR Module
   ========================================================================== */
.stock-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}
.stock-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.barcode-canvas {
    width: 100%;
    height: 60px;
    background: white;
    border-radius: 4px;
    margin-top: 1rem;
}

/* Time Clock Widget */
.clock-widget {
    text-align: center;
    padding: 2rem;
}
.clock-display {
    font-size: 2.5rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: var(--accent-gold);
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

/* ==========================================================================
   5. AI Assistant & Communications
   ========================================================================== */
.chat-container {
    display: grid;
    grid-template-columns: 240px 1fr;
    height: 600px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--glass-border);
}
.chat-channels {
    background: rgba(6, 15, 38, 0.45);
    border-right: 1px solid var(--glass-border);
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.channels-list {
    list-style: none;
}
.channel-item {
    padding: 0.6rem 1.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.channel-item:hover, .channel-item.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
}
.channel-item.active {
    border-left: 3px solid var(--accent-gold);
    color: var(--accent-gold);
    font-weight: 600;
}
.chat-main {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
}
.chat-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    font-weight: 600;
}
.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.message-bubble {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}
.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-gold);
    color: #060f26;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
}
.message-content {
    flex-grow: 1;
}
.message-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}
.message-user {
    font-size: 0.8125rem;
    font-weight: 700;
}
.message-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}
.message-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 0 10px 10px 10px;
    padding: 0.75rem 1rem;
    display: inline-block;
    max-width: 85%;
}
.message-bubble.me {
    flex-direction: row-reverse;
}
.message-bubble.me .message-text {
    background: linear-gradient(135deg, rgba(201, 168, 76, 0.2) 0%, rgba(201, 168, 76, 0.05) 100%);
    border-color: rgba(201, 168, 76, 0.25);
    border-radius: 10px 0 10px 10px;
}
.chat-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 0.75rem;
}

/* AI Floating Window / Slide-out Panel */
.ai-panel {
    position: fixed;
    top: calc(var(--topbar-height) + 16px);
    right: -420px;
    width: 380px;
    height: calc(100vh - var(--topbar-height) - 32px);
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border-focused);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), var(--shadow-gold-glow);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    z-index: 99;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
}
.ai-panel.active {
    right: 0;
}
.ai-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ai-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent-gold);
}
.ai-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.ai-bubble {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    line-height: 1.4;
}
.ai-bubble.assistant {
    background: rgba(201, 168, 76, 0.08);
    border: 1px solid rgba(201, 168, 76, 0.15);
    color: var(--text-primary);
}
.ai-bubble.user {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    align-self: flex-end;
}
.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0 1.25rem 0.5rem;
}
.ai-suggest-btn {
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
}
.ai-suggest-btn:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    background: rgba(201, 168, 76, 0.05);
}
.ai-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 0.5rem;
}

/* Typing Indicator */
.typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 12px;
}
.typing-dots span {
    width: 6px;
    height: 6px;
    background-color: var(--accent-gold);
    border-radius: 50%;
    opacity: 0.4;
    animation: typing 1.4s infinite ease-in-out both;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   6. GPS Tracking Map & Interactive Layout
   ========================================================================== */
.gps-map-container {
    width: 100%;
    height: 400px;
    border-radius: var(--radius-md);
    background: #040817;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--glass-border);
}
.map-svg {
    width: 100%;
    height: 100%;
    stroke: rgba(201, 168, 76, 0.1);
    stroke-width: 1.5;
    fill: none;
}
.map-staff-marker {
    position: absolute;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 10;
}
.marker-pulse {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-gold);
    border: 2px solid white;
    box-shadow: 0 0 10px var(--accent-gold);
    position: relative;
}
.marker-pulse::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--accent-gold);
    animation: markerPulse 2s infinite ease-out;
}
@keyframes markerPulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(3.5); opacity: 0; }
}
.marker-label {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--accent-gold);
    color: var(--text-primary);
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: var(--shadow-premium);
}

/* ==========================================================================
   7. Marketplace Onboarding Selection
   ========================================================================== */
.marketplace-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}
.marketplace-item {
    padding: 1.25rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
}
.marketplace-item.enabled {
    border-color: var(--accent-gold);
    background: rgba(201, 168, 76, 0.03);
}
.marketplace-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.marketplace-icon {
    font-size: 1.5rem;
    color: var(--accent-gold);
}
.marketplace-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-top: 0.5rem;
}
.marketplace-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Switch Toggle Styling */
.switch-control {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.switch-control input {
    opacity: 0;
    width: 0;
    height: 0;
}
.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid var(--glass-border);
}
.switch-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: .4s;
    border-radius: 50%;
}
.switch-control input:checked + .switch-slider {
    background-color: rgba(201, 168, 76, 0.2);
    border-color: var(--accent-gold);
}
.switch-control input:checked + .switch-slider:before {
    transform: translateX(20px);
    background-color: var(--accent-gold);
}
