/* ===================================
   CaptureTech Theme Variables
   =================================== */
:root {
    --ct-primary: #00baff;
    --ct-secondary: #000000;
    --ct-dark: #0064cd;
    --ct-contrast: #f03c5a;
    --container-max-width: 1100px;
    /* Sidebar dimensions */
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 64px;
}

/* ===================================
   Info Tooltip Icons - Lighter Gray
   =================================== */
.fa-info-circle,
.fa-circle-info {
    color: #adb5bd !important;
}

/* Info icons in alerts should inherit alert color */
.alert .fa-info-circle,
.alert .fa-circle-info {
    color: inherit !important;
}

/* ===================================
   Templates Page Styles
   =================================== */
.templates-root .swatch {
    width: 36px;
    height: 22px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

    .templates-root .swatch.primary {
        background: var(--ct-primary);
    }

    .templates-root .swatch.dark {
        background: var(--ct-dark);
    }

    .templates-root .swatch.contrast {
        background: var(--ct-contrast);
    }

.templates-root .theme-swatch {
    text-align: center;
    width: 64px;
}

.templates-root .preview-area {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

/* Container boxed variant */
.templates-root .container-boxed {
    max-width: var(--container-max-width);
    margin: 0 auto;
    background: #fff;
}

/* Template card tweaks */
.templates-root .template-card img {
    max-height: 140px;
    object-fit: cover;
}

.templates-root .template-card .card-title {
    color: var(--ct-secondary);
}

/* Preview area primary button styling */
.templates-root .preview-area .btn-primary {
    background: var(--ct-primary);
    border-color: var(--ct-primary);
}

/* ===================================
   Modal Template Styles
   =================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: none;
    align-items: center;
    justify-content: center;
}

    .modal-overlay.show {
        display: flex;
    }

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    z-index: 1051;
}

.modal-centered {
    position: relative;
    z-index: 1060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    width: 100%;
}

.modal-card {
    width: 100%;
    max-width: 720px;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.modal-close button {
    font-size: 1.05rem;
}

/* ===================================
   Gauge Chart Styles
   =================================== */
.gauge-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto;
}

.gauge {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.gauge-bg {
    fill: none;
    stroke: #e9ecef;
    stroke-width: 10;
}

.gauge-fill {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s ease-in-out, stroke 0.5s ease-in-out;
}

.gauge-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

/* ===================================
   Responsive Styles
   =================================== */
@media (max-width: 576px) {
    .templates-root {
        padding: 1rem;
    }

    .modal-card {
        max-width: 92%;
    }

    .gauge-container {
        width: 80px;
        height: 80px;
    }

    .gauge-value {
        font-size: 1rem;
    }
}

/* ===================================
   Button Styles
   =================================== */
.btn-save-config {
    color: #fff;
    background: linear-gradient(135deg, #00baff 0%, #0099dd 100%);
    border: none;
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-save-config:hover {
    color: #fff;
    background: linear-gradient(135deg, #0099dd 0%, #00baff 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 186, 255, 0.3);
}

.btn-save-config:disabled {
    color: #fff;
    background: linear-gradient(135deg, #00baff 0%, #0099dd 100%);
    opacity: 0.65;
    transform: none;
    box-shadow: none;
}

.btn-save-config:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 186, 255, 0.25);
}

.btn-save-config.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

/* ===================================
   Copilot Chatbot Styles
   =================================== */
.copilot-chatbot-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Floating help button */
.copilot-help-button {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--ct-primary) 0%, var(--ct-dark) 100%);
    color: #fff;
    font-size: 1.5rem;
    cursor: grab;
    box-shadow: 0 4px 16px rgba(0, 186, 255, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    user-select: none;
}

.copilot-help-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(0, 186, 255, 0.5);
}

.copilot-help-button:active {
    cursor: grabbing;
}

.copilot-help-button.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0);
}

/* Chat window - positioned relative to container */
.copilot-chat-window {
    position: fixed;
    width: 380px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
}

/* Position chat window based on container edge */
.copilot-chatbot-container[data-edge="bottom"] .copilot-chat-window,
.copilot-chatbot-container:not([data-edge]) .copilot-chat-window {
    bottom: 70px;
    right: 0;
    left: auto;
    top: auto;
}

.copilot-chatbot-container[data-edge="top"] .copilot-chat-window {
    top: 70px;
    bottom: auto;
    left: auto;
    right: 0;
    transform-origin: top right;
}

.copilot-chatbot-container[data-edge="left"] .copilot-chat-window {
    left: 70px;
    right: auto;
    bottom: 0;
    top: auto;
    transform-origin: bottom left;
}

.copilot-chatbot-container[data-edge="right"] .copilot-chat-window {
    right: 70px;
    left: auto;
    bottom: 0;
    top: auto;
    transform-origin: bottom right;
}

.copilot-chat-window.closed {
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
}

.copilot-chat-window.open {
    opacity: 1;
    transform: scale(1);
}

/* Chat header */
.copilot-chat-header {
    background: linear-gradient(135deg, var(--ct-primary) 0%, var(--ct-dark) 100%);
    color: #fff;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.copilot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.copilot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.copilot-header-text {
    display: flex;
    flex-direction: column;
}

.copilot-title {
    font-weight: 600;
    font-size: 1rem;
}

.copilot-status {
    font-size: 0.75rem;
    opacity: 0.9;
}

.copilot-status.online::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    margin-right: 6px;
}

.copilot-status.offline::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #fbbf24;
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 1.5s infinite;
}

.copilot-close-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.copilot-close-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Messages area */
.copilot-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Welcome message */
.copilot-welcome-message {
    text-align: center;
    padding: 24px;
    color: #64748b;
}

.copilot-welcome-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--ct-primary) 0%, var(--ct-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.75rem;
    color: #fff;
}

.copilot-welcome-message h5 {
    color: #1e293b;
    margin-bottom: 8px;
}

.copilot-welcome-message p {
    font-size: 0.9rem;
    margin: 0;
}

/* Message bubble */
.copilot-message {
    display: flex;
    gap: 8px;
    max-width: 85%;
}

.copilot-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.copilot-message.assistant {
    align-self: flex-start;
}

.copilot-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ct-primary) 0%, var(--ct-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.copilot-message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.copilot-message-text {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.copilot-message.user .copilot-message-text {
    background: linear-gradient(135deg, var(--ct-primary) 0%, var(--ct-dark) 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.copilot-message.assistant .copilot-message-text {
    background: #fff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.copilot-message-time {
    font-size: 0.7rem;
    color: #94a3b8;
    padding: 0 4px;
}

.copilot-message.user .copilot-message-time {
    text-align: right;
}

/* Typing indicator */
.copilot-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.copilot-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.copilot-typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.copilot-typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Input area */
.copilot-chat-input {
    padding: 12px 16px 16px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.copilot-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 4px 4px 4px 16px;
    transition: border-color 0.2s ease;
}

.copilot-input-wrapper:focus-within {
    border-color: var(--ct-primary);
}

.copilot-input-wrapper textarea {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    font-size: 0.9rem;
    padding: 8px 0;
    max-height: 120px;
    font-family: inherit;
    line-height: 1.4;
}

.copilot-input-wrapper textarea:focus {
    outline: none;
}

.copilot-input-wrapper textarea::placeholder {
    color: #94a3b8;
}

.copilot-send-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--ct-primary) 0%, var(--ct-dark) 100%);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.copilot-send-button:hover:not(:disabled) {
    transform: scale(1.05);
}

.copilot-send-button:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

.copilot-input-footer {
    text-align: center;
    margin-top: 8px;
}

.copilot-input-footer small {
    font-size: 0.7rem;
}

/* ===================================
   Selection Action Bar - Sidebar Aware
   =================================== */
/* Default: align with expanded sidebar */
.selection-action-bar {
    left: var(--sidebar-width, 240px) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                left 0.25s ease !important;
}

/* When sidebar is collapsed, adjust left position */
.sidebar.collapsed ~ .main .selection-action-bar {
    left: var(--sidebar-collapsed-width, 64px) !important;
}

/* Mobile: sidebar hidden, action bar spans full width */
@media (max-width: 767.98px) {
    .selection-action-bar {
        left: 0 !important;
    }
}
