/**
 * Main CSS for Miura Portal AI
 * Consolidated styles for the application
 */

/* ==========================================================================
   BASE STYLES
   ========================================================================== */

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
}

/* ==========================================================================
   CUSTOM SCROLLBARS
   ========================================================================== */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Prompt text specific scrollbar */
.prompt-text::-webkit-scrollbar {
    width: 6px;
}

.prompt-text::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.prompt-text::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.prompt-text::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* HTML input specific scrollbar */
#html-input::-webkit-scrollbar {
    width: 8px;
}

#html-input::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

#html-input::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

#html-input::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* ==========================================================================
   CARD COMPONENTS
   ========================================================================== */

.prompt-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.prompt-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
    color: #a0aec0;
}

.nav-link:hover {
    background-color: #1A2B3C;
    color: #ffffff;
}

.nav-link.active {
    background-color: #007BFF;
    color: #ffffff;
}

/* ==========================================================================
   PAGE CONTENT
   ========================================================================== */

.page-content {
    display: none;
}

.page-content.active {
    display: block;
}

/* ==========================================================================
   CATEGORY TABS
   ========================================================================== */

.category-tab {
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
}

.category-tab:hover {
    transform: translateY(-2px);
}

/* ==========================================================================
   PARAMETER CUSTOMIZATION
   ========================================================================== */

.parameters-container {
    margin-top: 1rem;
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
}

.toggle-parameters-btn {
    background: none;
    border: none;
    color: #007BFF;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    text-align: left;
    padding: 0;
    font-size: 0.9rem;
}

.parameters-content {
    margin-top: 1rem;
}

.parameter-group {
    margin-bottom: 0.75rem;
}

.parameter-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 0.25rem;
}

.parameter-group input,
.parameter-group textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.parameter-group input:focus,
.parameter-group textarea:focus {
    outline: none;
    border-color: #007BFF;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.word-counter {
    font-size: 0.75rem;
    text-align: right;
    color: #6b7280;
    padding-top: 2px;
}

.word-counter.over-limit {
    color: #b91c1c;
    font-weight: 600;
}

.parameters-explanation {
    font-size: 0.9rem;
    color: #4b5563;
    margin-bottom: 1.5rem;
    background-color: #f9fafb;
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

/* Parameter Actions */
.param-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.param-actions .action-btn {
    flex-grow: 1;
    padding: 0.6rem;
    font-weight: 600;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px solid transparent;
}

.quick-fill-btn {
    color: white;
    background-color: #1f2937;
}

.quick-fill-btn:hover {
    background-color: #374151;
}

.copy-params-btn {
    color: #374151;
    background-color: #f3f4f6;
    border-color: #d1d5db;
}

.copy-params-btn:hover {
    background-color: #e5e7eb;
}

.clear-params-btn {
    color: white;
    background-color: #6c757d;
}

.clear-params-btn:hover {
    background-color: #5a6268;
}

/* Parameter Tabs */
.param-tabs {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid #d1d5db;
    margin-bottom: 1rem;
}

.param-tab {
    background-color: transparent;
    border: none;
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.param-tab:hover {
    color: #1f2937;
}

.param-tab.active {
    color: #007BFF;
    border-color: #007BFF;
    font-weight: 600;
}

.add-new-tab {
    font-size: 1.2rem;
    font-weight: bold;
}

.delete-tab-btn {
    background-color: #f3f4f6;
    color: #9ca3af;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delete-tab-btn:hover {
    background-color: #fee2e2;
    color: #ef4444;
}

.param-tab-pane {
    display: none;
}

.param-tab-pane.active {
    display: block;
}

.param-tab-pane h4 {
    font-weight: 600;
    color: #111827;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

/* ==========================================================================
   MODAL COMPONENTS
   ========================================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(13, 27, 42, 0.6);
    z-index: 40;
    display: none;
}

.modal-overlay.show {
    display: block;
}

.modal-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    border-radius: 0.75rem;
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    width: 90%;
    max-width: 500px;
    z-index: 50;
    display: none;
}

.modal-panel.show {
    display: block;
}

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

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #9ca3af;
}

.modal-body {
    padding: 1.5rem;
}

.modal-body p {
    color: #4b5563;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.modal-body textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    min-height: 120px;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background-color: #f9fafb;
    border-bottom-left-radius: 0.75rem;
    border-bottom-right-radius: 0.75rem;
}

.modal-footer button {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-cancel-btn {
    background-color: white;
    border: 1px solid #d1d5db;
}

.modal-fill-btn {
    background-color: #1f2937;
    color: white;
    border: 1px solid #1f2937;
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */

.hidden {
    display: none;
}

/* Loading States */
.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007BFF;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
}

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

/* Search Highlight */
.search-highlight {
    background-color: #fef3c7;
    padding: 2px 4px;
    border-radius: 3px;
}

/* Tooltip */
.tooltip {
    position: fixed;
    background-color: #0D1B2A;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    transform: translateY(10px);
}

.tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 768px) {
    .modal-panel {
        width: 95%;
        margin: 1rem;
    }
    
    .param-actions {
        grid-template-columns: 1fr;
    }
    
    .category-tab {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }
}

/* ==========================================================================
   ADVANCED PARAMETERS STYLES
   ========================================================================== */

/* Parameters Container */
.parameters-container {
    margin-top: 1rem;
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
}

.toggle-parameters-btn {
    background: none;
    border: none;
    color: #007BFF;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    text-align: left;
    padding: 0;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.toggle-parameters-btn:hover {
    color: #0056b3;
}

.parameters-content {
    margin-top: 1rem;
}

.parameter-group {
    margin-bottom: 0.75rem;
}

.parameter-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 0.25rem;
}

.parameter-group input, 
.parameter-group textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.parameter-group input:focus, 
.parameter-group textarea:focus {
    outline: none;
    border-color: #007BFF;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.word-counter {
    font-size: 0.75rem;
    text-align: right;
    color: #6b7280;
    padding-top: 2px;
}

.word-counter.over-limit {
    color: #b91c1c;
    font-weight: 600;
}

.parameters-explanation {
    font-size: 0.9rem;
    color: #4b5563;
    margin-bottom: 1.5rem;
    background-color: #f9fafb;
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

/* Parameter Actions */
.param-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.param-actions .action-btn {
    flex-grow: 1;
    padding: 0.6rem;
    font-weight: 600;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px solid transparent;
    font-size: 0.875rem;
}

.quick-fill-btn {
    color: white;
    background-color: #1f2937;
}

.quick-fill-btn:hover {
    background-color: #374151;
}

.copy-params-btn {
    color: #374151;
    background-color: #f3f4f6;
    border-color: #d1d5db;
}

.copy-params-btn:hover {
    background-color: #e5e7eb;
}

.clear-params-btn {
    color: white;
    background-color: #6c757d;
}

.clear-params-btn:hover {
    background-color: #5a6268;
}

/* Parameter Tabs */
.param-tabs {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid #d1d5db;
    margin-bottom: 1rem;
}

.param-tab {
    background-color: transparent;
    border: none;
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.param-tab:hover {
    color: #1f2937;
}

.param-tab.active {
    color: #007BFF;
    border-color: #007BFF;
    font-weight: 600;
}

.add-new-tab {
    font-size: 1.2rem;
    font-weight: bold;
    color: #007BFF;
}

.add-new-tab:hover {
    color: #0056b3;
}

.delete-tab-btn {
    background-color: #f3f4f6;
    color: #9ca3af;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 0.5rem;
}

.delete-tab-btn:hover {
    background-color: #fee2e2;
    color: #ef4444;
}

.param-tab-pane {
    display: none;
}

.param-tab-pane.active {
    display: block;
}

.param-tab-pane h4 {
    font-weight: 600;
    color: #111827;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

/* Quick Fill Modal */
#quick-fill-modal-overlay {
    z-index: 50;
}

#quick-fill-modal {
    z-index: 51;
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    .nav-link,
    .modal-overlay,
    .tooltip {
        display: none !important;
    }
    
    .page-content {
        display: block !important;
    }
}