/* Demeterics Application Styles */

/* ==========================================
   Copy Button (Groq/GCP style)
   ========================================== */

/* Modern copy button with hover-to-show behavior */
.copy-key-btn {
    background: transparent;
    border: none;
    padding: 0.375rem;
    border-radius: 0.375rem;
    cursor: pointer;
    color: #6c757d;
    opacity: 0;
    transition: opacity 0.2s ease, background-color 0.2s ease, color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.copy-key-group:hover .copy-key-btn {
    opacity: 1;
}

.copy-key-btn:hover {
    background-color: var(--bs-gray-200);
    color: var(--bs-gray-700);
}

.copy-key-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(108, 117, 125, 0.25);
    opacity: 1; /* Show button on focus for accessibility */
}

.copy-key-btn:active {
    transform: scale(0.95);
}

.copy-key-btn svg {
    display: block;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .copy-key-btn {
        color: #adb5bd;
    }

    .copy-key-btn:hover {
        background-color: rgba(255, 255, 255, 0.1);
        color: #dee2e6;
    }
}

/* ==========================================
   Enhanced Form Controls
   ========================================== */

/* Modern select styling */
.form-select {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.5rem 2.25rem 0.5rem 0.75rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: #212529;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

.form-select:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

.form-select:hover:not(:focus):not(:disabled) {
    border-color: #adb5bd;
}

.form-select-sm {
    padding: 0.375rem 2rem 0.375rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.375rem;
}

/* Modern input styling */
.form-control {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: #212529;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

.form-control:hover:not(:focus):not(:disabled):not(:read-only) {
    border-color: #adb5bd;
}

.form-control-sm {
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.375rem;
}

/* ==========================================
   Enhanced Dropdown Styling
   ========================================== */

/* Modern dropdown menu */
.dropdown-menu {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
    padding: 0.5rem 0;
    min-width: 12rem;
    animation: dropdownFadeIn 0.15s ease-out;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-header {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    font-size: 0.9375rem;
    color: #212529;
    border-radius: 0;
    transition: background-color 0.1s ease;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: #f8f9fa;
    color: #212529;
}

.dropdown-item:active,
.dropdown-item.active {
    background-color: #e7f1ff;
    color: #0d6efd;
}

.dropdown-item i {
    width: 1.25rem;
    text-align: center;
}

.dropdown-divider {
    margin: 0.5rem 0;
    border-color: rgba(0, 0, 0, 0.08);
}

/* Dropdown toggle button styling */
.dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-toggle::after {
    margin-left: 0.5rem;
    vertical-align: middle;
    border-top-width: 0.35em;
    border-right-width: 0.35em;
    border-left-width: 0.35em;
}

/* Dropdown in card headers */
.card-header .dropdown-toggle {
    font-weight: 500;
}

/* ==========================================
   Enhanced Toast Styling
   ========================================== */

#toast-container {
    z-index: 9999;
}

#toast-container .toast {
    min-width: 280px;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

#toast-container .toast-header {
    border-radius: 0.5rem 0.5rem 0 0;
}

/* ==========================================
   Enhanced Modal Styling
   ========================================== */

.modal-content {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

.modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.75rem 0.75rem 0 0;
    padding: 1rem 1.25rem;
}

.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0 0 0.75rem 0.75rem;
    padding: 1rem 1.25rem;
}

.modal-body {
    padding: 1.25rem;
}

/* Alert and Confirm modal styling */
#alertModal .modal-header.bg-danger,
#alertModal .modal-header.bg-warning,
#alertModal .modal-header.bg-success,
#confirmModal .modal-header {
    border-bottom: none;
}

#alertModal .modal-header .btn-close-white,
#confirmModal .modal-header .btn-close-white {
    filter: brightness(0) invert(1);
}

/* ==========================================
   Enhanced Button Styling
   ========================================== */

.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.15s ease;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 0.375rem;
}

.btn-outline-secondary {
    border-color: #dee2e6;
    color: #495057;
}

.btn-outline-secondary:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
    color: #212529;
}

/* Button group with rounded corners */
.btn-group > .btn:first-child:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.btn-group > .btn:last-child:not(:first-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.btn-group > .btn:not(:first-child):not(:last-child) {
    border-radius: 0;
}
