/* Modular Issue Editor Styles */

/* Variables for consistent theming */
:root {
    --modal-backdrop: rgba(0, 0, 0, 0.5);
    --modal-bg: #ffffff;
    --modal-border: #dee2e6;
    --modal-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --form-bg: #f8f9fa;
    --form-border: #dee2e6;
    --form-focus: #007bff;
    --text-color: #212529;
    --text-muted: #6c757d;
    --danger-color: #dc3545;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --edit-btn-bg: #e9ecef;
    --edit-btn-hover: #dee2e6;
    --spinner-color: #007bff;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --modal-bg: #343a40;
        --modal-border: #495057;
        --form-bg: #495057;
        --form-border: #6c757d;
        --text-color: #f8f9fa;
        --text-muted: #adb5bd;
        --edit-btn-bg: #495057;
        --edit-btn-hover: #5a6268;
    }
}

/* Edit button styles */
/*.edit-issue-btn {*/
/*    display: inline-flex;*/
/*    align-items: center;*/
/*    justify-content: center;*/
/*    gap: var(--space-xs, 0.25rem);*/
/*    padding: var(--space-sm, 0.5rem) var(--space-md, 1rem);*/
/*    background: rgba(0, 122, 204, 0.1);*/
/*    border: 2px solid rgba(0, 122, 204, 0.2);*/
/*    border-radius: var(--radius-md, 8px);*/
/*    color: var(--accent-primary, #007acc);*/
/*    font-size: 0.85rem;*/
/*    font-weight: 600;*/
/*    cursor: pointer;*/
/*    transition: all 0.3s ease;*/
/*    white-space: nowrap;*/
/*    min-height: 36px;*/
/*    text-decoration: none;*/
/*    font-family: inherit;*/
/*}*/
.edit-issue-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs, 0.25rem);
    padding: var(--space-sm, 0.5rem) var(--space-md, 1rem);
    background: rgba(0, 122, 204, 0.1);
    border: 2px solid rgba(0, 122, 204, 0.2);
    border-radius: var(--radius-md, 8px);
    color: var(--accent-primary, #007acc);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-height: 36px; /* Match other buttons */
    height: 36px; /* Fixed height for consistency */
    line-height: 1; /* Normalize line height */
    text-decoration: none;
    font-family: inherit;
    box-sizing: border-box;
    vertical-align: top; /* Ensure consistent baseline */
}

.edit-issue-btn:hover {
    background: rgba(0, 122, 204, 0.2);
    border-color: rgba(0, 122, 204, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 204, 0.2);
}

.edit-issue-btn:focus {
    outline: 2px solid var(--accent-primary, #007acc);
    outline-offset: 2px;
}

.edit-issue-btn:active {
    transform: translateY(0);
}

.edit-icon {
    font-size: 0.85rem;
    line-height: 1;
}

.edit-text {
    font-size: 0.85rem;
    font-weight: 600;
}

/* Modal overlay */
.issue-edit-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 1rem;
}

.issue-edit-modal.show {
    opacity: 1;
    visibility: visible;
}

.issue-edit-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--modal-backdrop);
    backdrop-filter: blur(4px);
}

/* Modal content */
.issue-edit-content {
    position: relative;
    background: var(--modal-bg);
    border: 1px solid var(--modal-border);
    border-radius: 0.75rem;
    box-shadow: var(--modal-shadow);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-20px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Modal header */
.issue-edit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--modal-border);
    background: var(--form-bg);
}

.issue-edit-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
}

.issue-edit-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    line-height: 1;
}

.issue-edit-close:hover {
    background: var(--edit-btn-hover);
    color: var(--text-color);
}

/* Modal body */
.issue-edit-body {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

/* Modal footer */
.issue-edit-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--modal-border);
    background: var(--form-bg);
}

/* Form styles */
.issue-edit-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-section.search-section {
    background: var(--form-bg);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--form-border);
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

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

.form-label {
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.875rem;
}

.form-label .required {
    color: var(--danger-color);
}

.form-input,
.form-select,
.form-textarea {
    padding: 0.75rem;
    border: 1px solid var(--form-border);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: var(--text-color);
    background: var(--modal-bg);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--form-focus);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.character-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
}

.character-count.warning {
    color: var(--warning-color);
}

.character-count.error {
    color: var(--danger-color);
}

.field-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: normal;
}

/* Search functionality */
.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper .form-input {
    flex: 1;
    padding-right: 3rem;
}

.search-btn {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s ease;
}

.search-btn:hover {
    background: var(--form-bg);
}

.search-results {
    margin-top: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.search-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.no-results {
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
}

.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.results-header {
    padding: 0.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    border-bottom: 1px solid var(--form-border);
}

.search-result-item {
    padding: 0.75rem;
    border: 1px solid var(--form-border);
    border-radius: 0.375rem;
    background: var(--modal-bg);
    transition: all 0.2s ease;
}

.search-result-item:hover {
    background: var(--form-bg);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.result-id {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--form-bg);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.result-state {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 500;
}

.result-state.open {
    background: var(--primary-color);
    color: white;
}

.result-state.resolved {
    background: var(--success-color);
    color: white;
}

.result-title {
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.result-description {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.result-actions {
    display: flex;
    justify-content: flex-end;
}

.result-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

.result-link:hover {
    text-decoration: underline;
}

/* Platform selection */
.platform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
}

/*.platform-btn {*/
/*    display: flex;*/
/*    align-items: center;*/
/*    gap: 0.5rem;*/
/*    padding: 0.75rem;*/
/*    border: 1px solid var(--form-border);*/
/*    border-radius: 0.375rem;*/
/*    background: var(--modal-bg);*/
/*    cursor: pointer;*/
/*    transition: all 0.2s ease;*/
/*    font-size: 0.875rem;*/
/*}*/

/*.platform-btn:hover {*/
/*    background: var(--form-bg);*/
/*    transform: translateY(-1px);*/
/*    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);*/
/*}*/

/*.platform-btn.selected {*/
/*    background: var(--primary-color);*/
/*    color: white;*/
/*    border-color: var(--primary-color);*/
/*}*/

/*.platform-btn.selected:hover {*/
/*    background: var(--primary-color);*/
/*    filter: brightness(1.1);*/
/*}*/

/* Steps container */
.steps-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.step-number {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 500;
    flex-shrink: 0;
}

.step-input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--form-border);
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.step-remove-btn {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.step-remove-btn:hover {
    background: var(--danger-color);
    color: white;
}

.add-step-btn {
    align-self: flex-start;
    margin-top: 0.5rem;
}

/* Bug-specific fields */
.bug-specific-fields {
    background: var(--form-bg);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--form-border);
}

/* File upload styles */
.file-drop-zone {
    border: 2px dashed var(--form-border);
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.file-drop-zone:hover {
    border-color: var(--primary-color);
    background: var(--form-bg);
}

.file-drop-zone.drag-over {
    border-color: var(--primary-color);
    background: rgba(0, 123, 255, 0.1);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.drop-zone-icon {
    font-size: 2rem;
    color: var(--text-muted);
}

.drop-zone-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.drop-zone-text strong {
    color: var(--text-color);
}

.drop-zone-text span {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.file-list {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Button styles */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

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

.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #0056b3;
    border-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
    border-color: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-text {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-loading {
    display: none;
    align-items: center;
    gap: 0.5rem;
}

/* Spinner */
.spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Kanban edit button styles */
.kanban-edit-button {
    position: absolute;
    top: 0.5rem;
    right: 2rem;
    z-index: 10;
}

.kanban-edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(0, 122, 204, 0.1);
    border: 1px solid rgba(0, 122, 204, 0.2);
    border-radius: 50%;
    color: var(--accent-primary, #007acc);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: absolute;
    top: var(--space-sm, 0.5rem);
    right: var(--space-sm, 0.5rem);
    z-index: 2;
}

.kanban-issue-card:hover .kanban-edit-btn {
    opacity: 1;
    transform: scale(1);
}

.kanban-edit-btn:hover {
    background: rgba(0, 122, 204, 0.2);
    border-color: rgba(0, 122, 204, 0.4);
    transform: scale(1.1);
}

.kanban-edit-btn:focus {
    outline: 2px solid var(--accent-primary, #007acc);
    outline-offset: 2px;
}


/* Issue edit actions */
.issue-edit-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Responsive design */
@media (max-width: 768px) {
    .issue-edit-modal {
        padding: 0.5rem;
    }
    
    .issue-edit-content {
        max-height: 95vh;
    }
    
    .issue-edit-header,
    .issue-edit-body,
    .issue-edit-footer {
        padding: 1rem;
    }
    
    .form-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .platform-grid {
        grid-template-columns: 1fr;
    }
    
    .issue-edit-footer {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .issue-edit-footer .btn {
        width: 100%;
    }
    
    .edit-issue-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
        flex: 0 0 auto;
    }
    
    .edit-issue-btn .edit-text {
        display: none;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .issue-edit-modal,
    .issue-edit-content,
    .btn,
    /*.platform-btn,*/
    .search-result-item {
        transition: none;
    }
    
    .spinner {
        animation: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: more) {
    :root {
        --modal-border: #000000;
        --form-border: #000000;
        --text-color: #000000;
        --text-muted: #666666;
    }
    
    .form-input:focus,
    .form-select:focus,
    .form-textarea:focus {
        box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.5);
    }
}

/* testing something */
/* Mobile Responsive Styles */
@media (max-width: 768px) {
    /* Make edit button expand to full width like other action buttons */
    .issue-actions {
        display: flex;
        flex-direction: column;
        gap: var(--space-sm, 0.5rem);
        width: 100%;
    }

    .edit-issue-btn {
        width: 100%;
        justify-content: center;
        padding: var(--space-sm, 1rem);
        min-height: 44px; /* Better touch target */
        font-size: 0.9rem;
        border-radius: var(--radius-lg, 12px);
    }

    .edit-icon {
        font-size: 1rem;
    }

    .edit-text {
        font-size: 0.9rem;
        font-weight: 600;
    }

    /* Ensure all action buttons have consistent styling */
    .issue-actions .edit-issue-btn,
    .issue-actions .vote-button,
    .issue-actions .action-button {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: var(--space-xs, 0.25rem);
        padding: var(--space-md, 1rem);
        min-height: 44px;
        border-radius: var(--radius-lg, 12px);
        font-weight: 600;
        text-align: center;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .edit-issue-btn {
        padding: var(--space-sm, 0.5rem) var(--space-md, 1rem);
        min-height: 40px;
        font-size: 0.85rem;
    }

    .edit-icon {
        font-size: 1rem;
    }

    .edit-text {
        font-size: 0.85rem;
    }
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .edit-issue-btn {
        background: rgba(0, 122, 204, 0.15);
        border-color: rgba(0, 122, 204, 0.3);
        color: #4da6ff;
    }

    .edit-issue-btn:hover {
        background: rgba(0, 122, 204, 0.25);
        border-color: rgba(0, 122, 204, 0.5);
    }

    .kanban-edit-btn {
        background: rgba(0, 122, 204, 0.15);
        border-color: rgba(0, 122, 204, 0.3);
        color: #4da6ff;
    }

    .kanban-edit-btn:hover {
        background: rgba(0, 122, 204, 0.25);
        border-color: rgba(0, 122, 204, 0.5);
    }
}

/* Light Theme Support */
[data-theme="light"] .edit-issue-btn {
    background: rgba(0, 122, 204, 0.08);
    border-color: rgba(0, 122, 204, 0.2);
    color: #005a9c;
}

[data-theme="light"] .edit-issue-btn:hover {
    background: rgba(0, 122, 204, 0.15);
    border-color: rgba(0, 122, 204, 0.3);
}

[data-theme="light"] .kanban-edit-btn {
    background: rgba(0, 122, 204, 0.08);
    border-color: rgba(0, 122, 204, 0.2);
    color: #005a9c;
}

[data-theme="light"] .kanban-edit-btn:hover {
    background: rgba(0, 122, 204, 0.15);
    border-color: rgba(0, 122, 204, 0.3);
}

/* High Contrast Mode */
@media (prefers-contrast: more) {
    .edit-issue-btn {
        border-width: 3px;
        font-weight: 700;
    }

    .kanban-edit-btn {
        border-width: 2px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .edit-issue-btn,
    .kanban-edit-btn {
        transition: none;
    }

    .edit-issue-btn:hover,
    .kanban-edit-btn:hover {
        transform: none;
    }
}

/* Focus Management for Accessibility */
.edit-issue-btn:focus-visible {
    outline: 3px solid var(--accent-primary, #007acc);
    outline-offset: 2px;
}

.kanban-edit-btn:focus-visible {
    outline: 2px solid var(--accent-primary, #007acc);
    outline-offset: 2px;
}

/* Loading State (if needed) */
.edit-issue-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.edit-issue-btn.loading {
    position: relative;
    color: transparent;
}

.edit-issue-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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