/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #1a1a1a;
    color: #ffffff;
    overflow-x: hidden;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Header */
.header {
    background-color: #2d2d2d;
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid #444;
    position: sticky;
    top: 0;
    z-index: 100;
}


.header h1 {
    font-size: 1.2rem;
    font-weight: 600;
}


/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* File Explorer */
.file-explorer {
    width: 250px;
    min-width: 200px;
    max-width: 500px;
    background-color: #252525;
    border-right: 1px solid #444;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.explorer-header {
    padding: 1rem;
    background-color: #2d2d2d;
    border-bottom: 1px solid #444;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.explorer-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.close-panel {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.2rem;
    cursor: pointer;
    display: none;
}

.directory-selector {
    padding: 1rem;
}

.file-search {
    padding: 0 1rem 1rem 1rem;
    position: relative;
}

.search-input {
    width: 100%;
    background-color: #333;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    color: #fff;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: #007acc;
}

.search-input::placeholder {
    color: #888;
}

.search-clear {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    border-radius: 2px;
    transition: color 0.2s;
    display: none;
}

.search-clear:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

.search-clear.visible {
    display: block;
}

.btn-primary {
    background-color: #007acc;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    width: 100%;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #005a9e;
}

.file-tree {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.file-item {
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.file-item:hover {
    background-color: #333;
}

.file-item.active {
    background-color: #007acc;
}

.file-item.directory {
    font-weight: 500;
}

.file-item.directory .file-icon {
    color: #4db8ff;
}

.file-item.filtered {
    display: none;
}

.file-item .file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item .file-path {
    font-size: 0.75rem;
    color: #888;
    margin-left: 0.5rem;
}

.file-icon {
    margin-right: 0.5rem;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.search-highlight {
    background-color: rgba(77, 184, 255, 0.3);
    border-radius: 2px;
    padding: 0 2px;
}

.no-files {
    color: #888;
    font-style: italic;
    text-align: center;
    margin-top: 2rem;
}

/* Editor Section */
.editor-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.editor-header {
    background-color: #2d2d2d;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #444;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.current-file {
    font-weight: 500;
    color: #ccc;
    font-size: 0.9rem;
}

.editor-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.text-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: #999;
}

.stat-item {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.stat-separator {
    color: #666;
}

.editor-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-secondary {
    background-color: #444;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background-color 0.2s;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #555;
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.editor-container {
    flex: 1;
    position: relative;
    min-height: 0;
}

#textEditor {
    width: 100%;
    height: 100%;
    background-color: #1a1a1a;
    color: #ffffff;
    border: none;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
}

.CodeMirror {
    height: 100% !important;
    font-size: 14px;
    line-height: 1.5;
}

/* AI Sidebar */
.ai-sidebar {
    width: 300px;
    min-width: 250px;
    max-width: 600px;
    background-color: #252525;
    border-left: 1px solid #444;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1rem;
    background-color: #2d2d2d;
    border-bottom: 1px solid #444;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    background-color: #2d2d2d;
    border-bottom: 1px solid #444;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background-color 0.2s ease, color 0.2s ease;
    border-right: 1px solid #444;
}

.tab-btn:last-child {
    border-right: none;
}

.tab-btn:hover {
    background-color: #3a3a3a;
    color: #fff;
}

.tab-btn.active {
    background-color: #007acc;
    color: #fff;
}

/* Tab Content */
.tab-content {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
}

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

/* Settings Styles */
.settings-section {
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
}

.settings-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #ccc;
}

.setting-select {
    width: 100%;
    padding: 0.5rem;
    background-color: #333;
    border: 1px solid #555;
    border-radius: 4px;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
}

.setting-select:focus {
    outline: 2px solid #007acc;
    outline-offset: 2px;
}

/* Choices.js Dark Theme Customization */
.choices {
    position: relative;
    margin-bottom: 0;
    width: 100%;
}

.choices__inner {
    background-color: #333 !important;
    border: 1px solid #555 !important;
    border-radius: 4px !important;
    color: #fff !important;
    min-height: 44px;
    padding: 0.5rem !important;
}

.choices__list--single .choices__item {
    color: #fff !important;
    background-color: transparent !important;
}

.choices__placeholder {
    color: #aaa !important;
    opacity: 1 !important;
}

.choices__list--dropdown {
    background-color: #333 !important;
    border: 1px solid #555 !important;
    border-top: 0 !important;
    border-radius: 0 0 4px 4px !important;
    color: #fff !important;
    z-index: 1000;
}

.choices__list--dropdown .choices__item {
    color: #fff !important;
    background-color: #333 !important;
}

.choices__list--dropdown .choices__item--selectable:hover {
    background-color: #444 !important;
    color: #fff !important;
}

.choices__list--dropdown .choices__item--highlighted {
    background-color: #007acc !important;
    color: #fff !important;
}

.choices__input {
    color: #fff !important;
    background-color: transparent !important;
}

.choices__input:focus {
    outline: none !important;
}

.choices.is-focused .choices__inner {
    border-color: #007acc !important;
}

.choices.is-open .choices__inner {
    border-radius: 4px 4px 0 0 !important;
}

.choices__button {
    background-color: transparent !important;
    border: 0 !important;
    color: #fff !important;
    opacity: 0.7;
}

.choices__button:hover {
    opacity: 1;
}

/* Filter select styles for Usage Tracker */
.filter-select.choices .choices__inner {
    background-color: #1a1a1a !important;
    border: 1px solid #555 !important;
    padding: 0.4rem 0.6rem !important;
    min-height: auto;
}

/* Custom LLM Services Styles */
.custom-services-list {
    margin-bottom: 1rem;
}

.custom-service-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background-color: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.custom-service-info {
    flex: 1;
}

.custom-service-name {
    font-weight: 500;
    color: #fff;
    margin-bottom: 0.25rem;
}

.custom-service-details {
    font-size: 0.85rem;
    color: #ccc;
    display: flex;
    gap: 1rem;
}

.custom-service-key {
    font-family: monospace;
    background-color: #1a1a1a;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
}

.custom-service-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.custom-service-inputs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    color: #ddd;
}

.input-group small {
    font-size: 0.8rem;
    color: #aaa;
    margin-top: 0.25rem;
}

.custom-service-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.btn-danger {
    background-color: #dc3545;
    color: #fff;
    border: 1px solid #dc3545;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.section-header h4 {
    margin: 0;
    color: #fff;
}

.btn-small {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid #555;
    background-color: #333;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
}

.btn-small:hover {
    background-color: #007acc;
    border-color: #007acc;
}

.font-size-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.setting-range {
    flex: 1;
    height: 4px;
    background-color: #555;
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

.setting-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background-color: #007acc;
    border-radius: 50%;
    cursor: pointer;
}

.setting-range::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background-color: #007acc;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

.setting-value {
    font-size: 0.9rem;
    color: #007acc;
    font-weight: 600;
    min-width: 40px;
}

.setting-description {
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.25rem;
    line-height: 1.3;
}

.feedback-container {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.feedback-item {
    background-color: #333;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.feedback-item h4 {
    font-size: 0.9rem;
    color: #007acc;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.feedback-item p {
    font-size: 0.8rem;
    color: #ccc;
    line-height: 1.4;
    position: relative;
}

.feedback-item ul,
.feedback-item ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.feedback-item li {
    margin: 0.25rem 0;
    line-height: 1.4;
}

.feedback-item.error {
    background-color: #441111;
    border: 1px solid #cc4444;
}

.feedback-item.error h4 {
    color: #ff6666;
}

.feedback-item.placeholder-message {
    background-color: #2a2a2a;
    border: 1px dashed #555;
    text-align: center;
}

.feedback-item.placeholder-message h4 {
    color: #888;
}

.feedback-item.placeholder-message p {
    color: #666;
}

.feedback-item.placeholder-message small {
    color: #555;
}

.timing-info {
    color: #888;
    font-size: 0.75em;
    font-weight: normal;
    opacity: 0.8;
    margin-left: auto;
}


.priority-badge {
    display: inline-block;
    font-size: 0.6rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    margin-left: 0.5rem;
    font-weight: bold;
    text-transform: uppercase;
}

.priority-badge.high {
    background-color: #cc4444;
    color: white;
}

.priority-badge.medium {
    background-color: #cc8844;
    color: white;
}

.priority-badge.low {
    background-color: #44cc44;
    color: white;
}

.feedback-high {
    border-left: 3px solid #cc4444;
    padding-left: 0.5rem;
}

.feedback-medium {
    border-left: 3px solid #cc8844;
    padding-left: 0.5rem;
}

.feedback-low {
    border-left: 3px solid #44cc44;
    padding-left: 0.5rem;
}

.ai-actions {
    padding: 1rem;
    border-top: 1px solid #444;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-ai {
    background-color: #8b5cf6;
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.btn-ai:hover {
    background-color: #7c3aed;
}

/* Resize Handles */
.resize-handle {
    width: 4px;
    background-color: transparent;
    cursor: col-resize;
    transition: background-color 0.2s ease;
    position: relative;
    flex-shrink: 0;
}

.resize-handle:hover {
    background-color: #007acc;
}

.resize-handle:active {
    background-color: #0066aa;
}

.resize-handle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -2px;
    right: -2px;
    bottom: 0;
    cursor: col-resize;
}

.left-resize {
    border-right: 1px solid #444;
}

.right-resize {
    border-left: 1px solid #444;
}

/* Bottom Navigation (Mobile) */
.bottom-nav {
    display: none;
    background-color: #2d2d2d;
    border-top: 1px solid #444;
    padding: 0.5rem;
}

.nav-btn {
    background: none;
    border: none;
    color: #888;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    flex: 1;
    transition: color 0.2s;
}

.nav-btn.active {
    color: #007acc;
}

.nav-icon {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.nav-label {
    font-size: 0.7rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 1000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #444;
    border-top: 4px solid #007acc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loading-item {
    background-color: #2a3441;
    border: 1px solid rgba(77, 184, 255, 0.4);
    animation: pulse-border 2s ease-in-out infinite;
}

.loading-item h4 {
    color: #4db8ff;
    margin-bottom: 0.5rem;
}

.loading-item p {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.loading-timer {
    font-weight: bold;
    color: #4db8ff;
    background-color: rgba(77, 184, 255, 0.2);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    min-width: 2.5rem;
    text-align: center;
    flex-shrink: 0;
    margin-right: 0.25rem;
}

.loading-text {
    color: #ccc;
    font-style: italic;
    font-size: 0.8rem;
}

@keyframes pulse-border {
    0%, 100% {
        border-color: rgba(77, 184, 255, 0.4);
        box-shadow: 0 0 0 0 rgba(77, 184, 255, 0.3);
    }
    50% {
        border-color: rgba(77, 184, 255, 0.8);
        box-shadow: 0 0 0 2px rgba(77, 184, 255, 0.1);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.update-indicator {
    display: inline-block;
    transition: opacity 0.3s ease;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 0.75rem 1rem;
    }

    .header h1 {
        font-size: 1.1rem;
    }


    .main-content {
        position: relative;
    }

    .file-explorer,
    .ai-sidebar {
        position: fixed;
        top: 47px;
        bottom: 0;
        z-index: 200;
        transform: translateX(-100%);
    }

    .file-explorer.active {
        transform: translateX(0);
    }

    .ai-sidebar {
        right: 0;
        transform: translateX(100%);
    }

    .ai-sidebar.active {
        transform: translateX(0);
    }

    .close-panel {
        display: block;
    }

    .editor-section {
        width: 100%;
    }

    .bottom-nav {
        display: none;
    }

    #textEditor {
        font-size: 16px;
    }

    .CodeMirror {
        font-size: 16px;
    }
}

/* Portrait Phone Specific */
@media (max-width: 480px) and (orientation: portrait) {
    .header {
        padding: 0.5rem 0.75rem;
    }

    .header h1 {
        font-size: 1rem;
    }

    .file-explorer,
    .ai-sidebar {
        width: 100vw;
        top: 37px;
    }

    .editor-header {
        padding: 0.5rem 0.75rem;
    }

    .current-file {
        font-size: 0.8rem;
    }
    
    .editor-info {
        gap: 0.125rem;
        min-width: 0;
        flex: 1;
    }
    
    .text-stats {
        font-size: 0.7rem;
        gap: 0.375rem;
    }

    .btn-secondary {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }

    .feedback-item {
        padding: 0.75rem;
    }

    .feedback-item h4 {
        font-size: 0.85rem;
    }

    .feedback-item p {
        font-size: 0.75rem;
    }

    .ai-actions {
        padding: 0.75rem;
    }

    .btn-ai {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    .nav-icon {
        font-size: 1.1rem;
    }

    .nav-label {
        font-size: 0.65rem;
    }
}

/* Landscape Phone */
@media (max-width: 768px) and (orientation: landscape) {
    .file-explorer,
    .ai-sidebar {
        width: 70vw;
        max-width: 300px;
    }

    .bottom-nav {
        padding: 0.25rem;
    }

    .nav-btn {
        padding: 0.25rem;
    }

    .nav-icon {
        font-size: 1rem;
        margin-bottom: 0.1rem;
    }

    .nav-label {
        font-size: 0.6rem;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .file-explorer {
        width: 220px;
    }

    .ai-sidebar {
        width: 280px;
    }

    .header h1 {
        font-size: 1.1rem;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.blur-background {
    filter: blur(2px);
    pointer-events: none;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .file-explorer,
    .ai-sidebar {
        border-width: 2px;
    }

    .feedback-item {
        border: 1px solid #666;
    }
}

/* Prompts Section */
.prompts-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1rem;
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.section-header h4 {
    color: #ccc;
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-small {
    background-color: #007acc;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.btn-small:hover {
    background-color: #005a9e;
}

.prompts-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.no-prompts {
    color: #666;
    font-size: 0.85rem;
    text-align: center;
    padding: 1rem;
    font-style: italic;
}

.prompt-item {
    background-color: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    position: relative;
    cursor: move;
    transition: all 0.2s ease;
}

.prompt-item.disabled {
    opacity: 0.6;
}

.prompt-item.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.prompt-item.drag-over-top {
    border-top: 2px solid #007acc;
}

.prompt-item.drag-over-bottom {
    border-bottom: 2px solid #007acc;
}

.prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.drag-handle {
    color: #666;
    font-size: 16px;
    margin-right: 8px;
    cursor: grab;
    user-select: none;
    line-height: 1;
}

.drag-handle:hover {
    color: #007acc;
}

.prompt-item.dragging .drag-handle {
    cursor: grabbing;
}

.prompt-name {
    font-weight: 500;
    color: #fff;
    font-size: 0.9rem;
}

.prompt-actions {
    display: flex;
    gap: 0.25rem;
}

.btn-icon {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 3px;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-icon:hover {
    color: #fff;
    background-color: #444;
}

.btn-icon.danger:hover {
    color: #ff6b6b;
    background-color: rgba(255, 107, 107, 0.1);
}

.btn-icon.auto-refresh-toggle {
    margin-left: 0.5rem;
    font-size: 0.7rem;
    transition: all 0.2s;
}

.btn-icon.auto-refresh-toggle.enabled:hover {
    background-color: rgba(76, 175, 80, 0.2);
    transform: scale(1.1);
}

.btn-icon.auto-refresh-toggle.disabled:hover {
    background-color: rgba(244, 67, 54, 0.2);
    transform: scale(1.1);
}

.prompt-trigger {
    color: #007acc;
    font-size: 0.75rem;
    margin: 0.25rem 0;
    padding: 0.15rem 0.4rem;
    background-color: rgba(0, 122, 204, 0.1);
    border-radius: 3px;
    border: 1px solid rgba(0, 122, 204, 0.2);
    display: inline-block;
    font-weight: 500;
}

.prompt-preview {
    color: #999;
    font-size: 0.8rem;
    line-height: 1.3;
    max-height: 2.6rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Countdown Timer Styles */
.countdown-timer {
    color: #ffa500;
    font-size: 0.75rem;
    margin: 0.25rem 0;
    padding: 0.2rem 0.5rem;
    background-color: rgba(255, 165, 0, 0.1);
    border-radius: 3px;
    border: 1px solid rgba(255, 165, 0, 0.3);
    font-weight: 500;
    animation: pulse-countdown 2s infinite;
}

@keyframes pulse-countdown {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}


/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background-color: #2d2d2d;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #444;
}

.modal-header h3 {
    margin: 0;
    color: #fff;
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    color: #999;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    color: #fff;
    background-color: #444;
}

.modal-body {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #ccc;
    font-size: 0.9rem;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    background-color: #1a1a1a;
    border: 1px solid #444;
    border-radius: 4px;
    color: #fff;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007acc;
    box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.2);
}

.form-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

.form-group label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.form-hint {
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.5rem;
    line-height: 1.4;
    padding: 0.5rem 0.75rem;
    background-color: rgba(0, 122, 204, 0.1);
    border-left: 3px solid #007acc;
    border-radius: 0 4px 4px 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #444;
}


/* Citation/Reference Specific Styles */
.citation-item {
    background-color: #2a3441;
    border-left: 4px solid #4db8ff;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    position: relative;
}

.citation-item .citation-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.citation-item .citation-icon {
    color: #4db8ff;
    font-size: 1.1rem;
}

.citation-item .citation-title {
    font-size: 0.9rem;
    color: #4db8ff;
    font-weight: 600;
    margin: 0;
}

.citation-content {
    display: grid;
    gap: 0.5rem;
}

.citation-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.citation-field .field-label {
    font-size: 0.75rem;
    color: #888;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.citation-field .field-value {
    font-size: 0.85rem;
    color: #e0e0e0;
    line-height: 1.4;
}

.citation-field .field-value.link {
    color: #66b3ff;
    text-decoration: underline;
    cursor: pointer;
}

.citation-field .field-value.link:hover {
    color: #4da6ff;
}

/* Diff/Edit Specific Styles */
.diff-item {
    background-color: #2d1b1b;
    border-left: 4px solid #ff6b6b;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    position: relative;
}

.diff-item .diff-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.diff-item .diff-icon {
    color: #ff6b6b;
    font-size: 1.1rem;
}

.diff-item .diff-title {
    font-size: 0.9rem;
    color: #ff6b6b;
    font-weight: 600;
    margin: 0;
}

.diff-content {
    display: grid;
    gap: 0.75rem;
}

.diff-section {
    position: relative;
}

.diff-section .section-label {
    font-size: 0.75rem;
    color: #888;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    display: block;
}

.diff-text {
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    padding: 0.75rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.diff-text.original {
    background-color: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.3);
    color: #ffcccc;
}

.diff-text.suggested {
    background-color: rgba(107, 255, 107, 0.1);
    border-color: rgba(107, 255, 107, 0.3);
    color: #ccffcc;
}

.diff-text::before {
    content: attr(data-label);
    position: absolute;
    top: -0.5rem;
    left: 0.75rem;
    background-color: #2d2d2d;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    color: #888;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.diff-reason {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 0.75rem;
    font-size: 0.85rem;
    color: #ccc;
    line-height: 1.4;
    border-left: 3px solid #007acc;
    margin-top: 0.5rem;
}

.diff-reason::before {
    content: "💡 ";
    color: #007acc;
    font-weight: bold;
}

/* Reference List Styles */
.reference-list {
    background-color: #1a2332;
    border-left: 4px solid #66b3ff;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.reference-list .reference-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.reference-list .reference-icon {
    color: #66b3ff;
    font-size: 1.1rem;
}

.reference-list .reference-title {
    font-size: 0.9rem;
    color: #66b3ff;
    font-weight: 600;
    margin: 0;
}

.reference-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.reference-item {
    background-color: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    padding: 0.75rem;
    border: 1px solid rgba(102, 179, 255, 0.2);
}

.reference-source {
    font-weight: 600;
    color: #e0e0e0;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.reference-details {
    display: grid;
    gap: 0.5rem;
}

.reference-detail {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.reference-detail .detail-label {
    font-size: 0.75rem;
    color: #888;
    font-weight: 600;
    min-width: 70px;
    flex-shrink: 0;
}

.reference-detail .detail-value {
    font-size: 0.8rem;
    color: #ccc;
    line-height: 1.4;
    flex: 1;
}

.reference-detail .detail-value.url {
    color: #66b3ff;
    text-decoration: underline;
    cursor: pointer;
    word-break: break-all;
}

.reference-detail .detail-value.url:hover {
    color: #4da6ff;
}

/* Enhanced priority badges for special content types */
.priority-badge.citation {
    background-color: #4db8ff;
    color: #ffffff;
}

.priority-badge.diff {
    background-color: #ff6b6b;
    color: #ffffff;
}

.priority-badge.reference {
    background-color: #66b3ff;
    color: #ffffff;
}

.priority-badge.analysis {
    background-color: #9966ff;
    color: #ffffff;
}

/* Mobile Modal Adjustments */
@media (max-width: 768px) {
    .modal {
        margin: 1rem;
        width: calc(100% - 2rem);
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }

    .citation-item,
    .diff-item,
    .reference-list {
        padding: 0.75rem;
    }

    .diff-text {
        font-size: 0.75rem;
        padding: 0.5rem;
    }

    .citation-content,
    .diff-content {
        gap: 0.5rem;
    }
}

/* Usage Tracking Styles */
.usage-section {
    padding: 0;
}

.usage-controls {
    display: flex;
    gap: 0.5rem;
}

.usage-overview {
    margin-bottom: 1.5rem;
}

.usage-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.usage-stat-card {
    background-color: #2d2d2d;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.usage-stat-card h5 {
    font-size: 0.8rem;
    color: #bbb;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    font-weight: 500;
}

.usage-stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #4db8ff;
}

.usage-filters {
    background-color: #2d2d2d;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-group label {
    min-width: 80px;
    font-size: 0.9rem;
    color: #ccc;
}

.filter-select,
.filter-input {
    background-color: #1a1a1a;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    color: #fff;
    font-size: 0.9rem;
}

.custom-date-range {
    display: none;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-left: 80px;
}

.custom-date-range span {
    color: #ccc;
    font-size: 0.9rem;
}

.usage-details,
.usage-history {
    margin-bottom: 1.5rem;
}

.history-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.search-input {
    background-color: #1a1a1a;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    color: #fff;
    font-size: 0.9rem;
    min-width: 150px;
}

.prompt-usage-list,
.calls-list {
    max-height: 300px;
    overflow-y: auto;
}

.prompt-usage-card {
    background-color: #2d2d2d;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.prompt-usage-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.prompt-usage-header h5 {
    color: #fff;
    font-size: 1rem;
    margin: 0;
    flex: 1;
}

.usage-badge {
    background-color: #4db8ff;
    color: #fff;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.prompt-usage-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
}

.usage-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detail-label {
    font-size: 0.8rem;
    color: #bbb;
}

.detail-value {
    font-size: 0.8rem;
    color: #fff;
    font-weight: 500;
}

.call-item {
    background-color: #2d2d2d;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.call-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.call-prompt {
    font-weight: 500;
    color: #fff;
}

.call-timestamp {
    font-size: 0.8rem;
    color: #bbb;
}

.call-details {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.8rem;
}

.call-stat {
    color: #4db8ff;
}

.call-provider {
    color: #66b3ff;
}

.call-model {
    color: #99ccff;
}

.call-session {
    color: #bbb;
}

.no-data {
    text-align: center;
    color: #bbb;
    font-style: italic;
    padding: 2rem;
}

@media (max-width: 768px) {
    .usage-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .usage-stat-card {
        padding: 0.75rem;
    }
    
    .usage-stat-value {
        font-size: 1.2rem;
    }
    
    .filter-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .filter-group label {
        min-width: auto;
    }
    
    .custom-date-range {
        padding-left: 0;
        flex-wrap: wrap;
    }
    
    .history-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-input {
        min-width: auto;
    }
    
    .prompt-usage-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .prompt-usage-details {
        grid-template-columns: 1fr;
    }
    
    .call-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .call-details {
        gap: 0.5rem;
    }
}
