/* 
 * QA Assistant Admin Bar Styles
 * Theme: Tailwind/Shadcn inspired (Slate 50-900)
 */

/* --- Dropdown Container --- */
#wpadminbar .qa_assistant_git-branch-group .ab-sub-wrapper,
#wpadminbar .qa_assistant_git-branch .ab-sub-wrapper,
#wpadminbar .qa-admin-bar-root .ab-sub-wrapper {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    /* Slate-200 */
    border-radius: 8px !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
    padding: 6px !important;
    min-width: 260px !important;
    max-width: 320px !important;
}

/* --- Menu Items General --- */
#wpadminbar .qa_assistant_git-branch .ab-sub-wrapper .ab-item,
#wpadminbar .qa_assistant_git-branch .ab-sub-wrapper a.ab-item,
#wpadminbar .qa-admin-bar-root .ab-sub-wrapper .ab-item,
#wpadminbar .qa-admin-bar-root .ab-sub-wrapper a.ab-item {
    color: #64748b !important;
    /* Slate-500 */
    font-size: 13px !important;
    font-weight: 500 !important;
    padding: 6px 10px !important;
    border-radius: 6px !important;
    transition: all 0.15s ease !important;
    background: transparent !important;
    height: auto !important;
    line-height: 1.5 !important;
    margin-bottom: 2px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

#wpadminbar .qa_assistant_git-branch .ab-sub-wrapper .ab-item:hover,
#wpadminbar .qa_assistant_git-branch .ab-sub-wrapper a.ab-item:hover,
#wpadminbar .qa-admin-bar-root .ab-sub-wrapper .ab-item:hover,
#wpadminbar .qa-admin-bar-root .ab-sub-wrapper a.ab-item:hover {
    background-color: #f1f5f9 !important;
    /* Slate-100 */
    color: #0f172a !important;
    /* Slate-900 */
}

/* --- Key Elements --- */

/* Root Icon */
.qa-admin-bar-icon {
    display: inline-flex !important;
    align-items: center !important;
    margin-right: 4px !important;
    color: #a1a1aa !important;
    /* Zinc-400 */
    margin-top: 2px !important;
    /* Visual alignment fix */
}

#wpadminbar:hover .qa-admin-bar-icon {
    color: #fff !important;
}

/* Parent Item Adjustment */
#wpadminbar .qa-admin-bar-root>.ab-item,
#wpadminbar .qa_assistant_git-branch>.ab-item {
    display: flex !important;
    align-items: center !important;
}

/* Fix arrow alignment on parent items */
#wpadminbar .qa-admin-bar-root>.ab-item::after,
#wpadminbar .qa_assistant_git-branch>.ab-item::after {
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin-top: 0 !important;
}

/* Repo Name & Badge */
.qa-repo-name {
    color: #0f172a !important;
    /* Slate-900 */
    font-weight: 600 !important;
    margin-right: auto !important;
}

.qa-branch-badge {
    background: #f1f5f9 !important;
    /* Slate-100 */
    color: #475569 !important;
    /* Slate-600 */
    font-size: 11px !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    font-family: monospace !important;
    border: 1px solid #e2e8f0 !important;
}

/* --- Toolbar (Pull & Refresh) --- */
#wpadminbar .qa-toolbar-container {
    padding: 8px 8px 8px 8px;
    border-bottom: 1px solid #e2e8f0;
    /* Slate-200 */
    background-color: #ffffff;
    /* Slate-50 */
    border-radius: 8px 8px 0 0;
    margin-bottom: 4px;
}

#wpadminbar .qa-branch-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
}

#wpadminbar .qa-toolbar-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #f8fafc;
    /* Subtle background */
    border: 1px solid #e2e8f0;
    /* Define border */
    cursor: pointer;
    color: #475569;
    /* Slate-600 */
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    line-height: 1;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

#wpadminbar .qa-toolbar-btn:hover {
    color: #0f172a;
    /* Slate-900 */
    background-color: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.05);
}

#wpadminbar .qa-toolbar-btn:active {
    background-color: #f1f5f9;
    box-shadow: inset 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

#wpadminbar .qa-toolbar-btn svg {
    display: block;
    color: #64748b;
}

#wpadminbar .qa-toolbar-btn:hover svg {
    color: #3b82f6;
    /* Blue-500 hover */
}

/* Loading state for buttons */
#wpadminbar .qa-toolbar-btn.qa-pull-loading,
#wpadminbar .qa-toolbar-btn.qa-refresh-loading {
    opacity: 0.7;
    cursor: wait;
    background-color: #f1f5f9;
}

/* --- Search Input --- */
#wpadminbar .qa-search-node {
    padding: 0 8px 8px 8px;
    background-color: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    /* Slate-100 */
}

#wpadminbar .qa-search-container {
    position: relative;
    display: flex;
    align-items: center;
}

#wpadminbar .qa-search-icon {
    position: absolute;
    left: 10px;
    color: #94a3b8;
    /* Slate-400 */
    pointer-events: none;
    width: 14px;
    height: 14px;
}

#wpadminbar .qa-branch-search-input {
    width: 100%;
    padding: 6px 10px 6px 30px;
    /* Left padding for icon */
    font-size: 13px;
    line-height: 1.5;
    color: #0f172a;
    /* Slate-900 */
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    /* Slate-200 */
    border-radius: 6px;
    transition: all 0.2s;
    outline: none;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    height: 32px;
    min-height: 32px;
}

#wpadminbar .qa-branch-search-input:focus {
    border-color: #3b82f6;
    /* Blue-500 */
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

#wpadminbar .qa-branch-search-input::placeholder {
    color: #94a3b8;
    /* Slate-400 */
}

/* --- Scrollable List --- */
#wpadminbar .qa-branch-list-scrollable,
#wpadminbar .qa-branch-list-scrollable .ab-sub-wrapper {
    max-height: 300px !important;
    overflow-y: auto !important;
    overflow-x: hidden;
    padding-top: 4px;
    padding-bottom: 4px;
    border-radius: 0 0 8px 8px;
}

/* --- Branch Items --- */
#wpadminbar .qa_assistant_git-branch-item .ab-item {
    height: auto !important;
    padding: 6px 10px !important;
    line-height: 1.5 !important;
    border-left: 2px solid transparent !important;
    /* Prepare for active border */
}

#wpadminbar .qa-branch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

#wpadminbar .qa-branch-name {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Mono', 'Droid Sans Mono', 'Source Code Pro', monospace;
    font-size: 12px;
    color: #475569;
    /* Slate-600 */
}

#wpadminbar .qa-branch-row:hover .qa-branch-name {
    color: #0f172a;
    /* Slate-900 */
}

/* Main Branch styling */
#wpadminbar .qa_assistant_git-branch-item.main-branch .qa-branch-name {
    font-weight: 600;
    color: #334155;
}

/* Current Branch Indicator & Active Row */
#wpadminbar .qa_assistant_git-branch-item.current .ab-item {
    background-color: #e0f2fe !important;
    /* Sky-100 (darker than previous slate-50/sky-50) */
    border-left-color: #0284c7 !important;
    /* Sky-600 */
}

#wpadminbar .qa_assistant_git-branch-item.current .qa-branch-name {
    color: #0369a1;
    /* Sky-700 */
    font-weight: 700;
}

#wpadminbar .qa-current-indicator {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: #e0f2fe;
    /* Sky-100 */
    color: #0369a1;
    /* Sky-700 */
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Highlight */
.qa-branch-highlight {
    background-color: #fef08a;
    /* Yellow-200 */
    color: #854d0e;
    /* Yellow-800 */
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}

/* Empty State */
.qa-no-branches {
    padding: 12px !important;
    text-align: center;
    color: #94a3b8 !important;
    font-style: italic;
    font-size: 13px;
    cursor: default;
}

.qa-no-branches:hover {
    background-color: transparent !important;
}

/* Scrollbar Styling */
#wpadminbar .qa-branch-list-scrollable .ab-sub-wrapper::-webkit-scrollbar {
    width: 6px;
}

#wpadminbar .qa-branch-list-scrollable .ab-sub-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

#wpadminbar .qa-branch-list-scrollable .ab-sub-wrapper::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    /* Slate-300 */
    border-radius: 20px;
}

#wpadminbar .qa-branch-list-scrollable .ab-sub-wrapper::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
    /* Slate-400 */
}

/* Animations */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.qa-spin {
    animation: spin 1s linear infinite;
}

/* --- Notification System --- */
.qa-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    width: 320px;
    z-index: 999999;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.qa-notification-show {
    transform: translateX(0);
}

.qa-notification-hide {
    transform: translateX(120%);
}

.qa-notification-content {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    gap: 12px;
}

.qa-notification-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    margin-top: 2px;
}

.qa-notification-text {
    flex: 1;
    min-width: 0;
}

.qa-notification-title {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
}

.qa-notification-message {
    font-size: 13px;
    color: #475569;
    line-height: 1.5;
}

.qa-notification-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    padding: 2px;
    margin: -2px -2px 0 0;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qa-notification-close:hover {
    color: #0f172a;
    background: #f1f5f9;
}

.qa-notification-svg {
    width: 100%;
    height: 100%;
}

.qa-notification-success .qa-notification-icon {
    color: #10b981;
}

.qa-notification-error .qa-notification-icon {
    color: #ef4444;
}

.qa-notification-warning .qa-notification-icon {
    color: #f59e0b;
}

.qa-notification-info .qa-notification-icon {
    color: #3b82f6;
}

.qa-notification-progress {
    height: 3px;
    background: #e2e8f0;
    width: 100%;
    transform-origin: left;
}

.qa-notification-progress-animate {
    animation: qa-progress 5s linear forwards;
}

@keyframes qa-progress {
    0% {
        transform: scaleX(1);
    }

    100% {
        transform: scaleX(0);
    }
}

.qa-notification-success .qa-notification-progress-animate {
    background: #10b981;
}

.qa-notification-error .qa-notification-progress-animate {
    background: #ef4444;
}

.qa-notification-warning .qa-notification-progress-animate {
    background: #f59e0b;
}

.qa-notification-info .qa-notification-progress-animate {
    background: #3b82f6;
}

/* --- Action Modal --- */
.qa-action-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    animation: qaModalFadeIn 0.2s ease-out;
}

.qa-action-modal-content {
    background: #ffffff;
    border-radius: 8px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: qaModalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.qa-action-modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.qa-action-modal-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
}

.qa-action-modal-close {
    background: none;
    border: none;
    color: #64748b;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.qa-action-modal-close:hover {
    color: #0f172a;
}

.qa-action-modal-body {
    padding: 24px;
    color: #334155;
    font-size: 14px;
    line-height: 1.5;
}

.qa-action-modal-body p {
    margin-top: 0;
    margin-bottom: 16px;
}

.qa-commit-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed #cbd5e1;
}

.qa-commit-section label {
    font-weight: 500;
    color: #0f172a;
    font-size: 13px;
}

.qa-commit-input {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.qa-commit-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.qa-action-modal-footer {
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.qa-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.qa-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.qa-btn-secondary {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
}

.qa-btn-secondary:hover:not(:disabled) {
    background: #f1f5f9;
    color: #0f172a;
}

.qa-btn-primary {
    background: #3b82f6;
    color: #ffffff;
}

.qa-btn-primary:hover:not(:disabled) {
    background: #2563eb;
}

.qa-btn-warning {
    background: #f59e0b;
    color: #ffffff;
}

.qa-btn-warning:hover:not(:disabled) {
    background: #d97706;
}

@keyframes qaModalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes qaModalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}