/**
 * Admin CSS for HD SofT AI Summary
 *
 * @package HDSofT\AISummary
 */

/* Settings Page Styles */
.hdsoft-ai-summary-settings {
    max-width: 1200px;
}

/* Connection Test Styles */
#connection-result {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    font-weight: 600;
    display: none;
}

#connection-result.success {
    background: #d1e7dd;
    border: 1px solid #badbcc;
    color: #0f5132;
    display: block;
}

#connection-result.error {
    background: #f8d7da;
    border: 1px solid #f5c2c7;
    color: #842029;
    display: block;
}

#test-connection {
    margin-top: 10px;
}

#test-connection:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Model Cost Warning */
#model-cost-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 10px;
    margin-top: 10px;
    color: #856404;
}

/* Model Selection Interface */
#model-selection-container {
    max-width: 600px;
}

.model-search-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

#model-search {
    flex: 1;
    min-width: 0;
}

#load-models {
    flex-shrink: 0;
}

#current-model-display {
    background: #f0f0f1;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 12px;
    margin: 10px 0;
    font-size: 14px;
}

#current-model-name {
    font-family: Consolas, Monaco, 'Courier New', monospace;
    color: #0073aa;
    font-weight: 600;
}

#models-list {
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#models-loading {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

.model-item {
    padding: 20px;
    border: 3px solid #333333;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    background: #ffffff;
    margin-bottom: 5px;
    border-radius: 6px;
}

.model-item:nth-child(odd) {
    background: #ffffff !important;
    border-color: #000000 !important;
}

.model-item:nth-child(even) {
    background: #e0e0e0 !important;
    border-color: #666666 !important;
}

.model-item:last-child {
    border-bottom: 3px solid #333333;
}

.model-item:hover {
    background: #ffff00 !important;
    border: 4px solid #ff0000 !important;
    box-shadow: 0 5px 15px rgba(255, 0, 0, 0.5) !important;
    transform: translateY(-2px) !important;
}

.model-item.selected {
    background: #00ff00 !important;
    border: 5px solid #0000ff !important;
    box-shadow: 0 8px 20px rgba(0, 0, 255, 0.6) !important;
    transform: scale(1.02) !important;
}

.model-item .model-name {
    font-weight: 900;
    color: #000000;
    margin-bottom: 8px;
    font-size: 18px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.model-item .model-id {
    font-size: 14px;
    font-family: Consolas, Monaco, 'Courier New', monospace;
    margin-bottom: 8px;
    background: #ff6600;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    display: inline-block;
    font-weight: 900;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    border: 2px solid #000000;
}

.model-item .model-description {
    font-size: 14px;
    color: #000000;
    line-height: 1.6;
    font-weight: 700;
}

.model-item .recommended-badge {
    background: #00a32a;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 8px;
    vertical-align: middle;
}

.model-item .pricing {
    color: #666;
    font-size: 12px;
    font-weight: normal;
}

/* Model search enhancements */
#model-search:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Loading state for load models button */
#load-models:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Empty state */
.models-empty {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* Responsive adjustments for model selection */
@media screen and (max-width: 782px) {
    .model-search-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    #load-models {
        margin-left: 0;
        margin-top: 10px;
    }
    
    #models-list {
        max-height: 250px;
    }
    
    .model-item {
        padding: 10px;
    }
}

/* High contrast mode for model selection */
@media (prefers-contrast: high) {
    .model-item.selected {
        border-left-width: 4px;
        background: #000;
        color: #fff;
    }
    
    .model-item:hover {
        background: #f0f0f0;
        border: 1px solid #000;
    }
}

/* Focus states for model items */
.model-item:focus {
    outline: 2px solid #0073aa;
    outline-offset: -2px;
}

/* Animation for model list appearance */
#models-list {
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

#models-list.show {
    opacity: 1;
    transform: translateY(0);
}

/* Branding Styles */
.hdsoft-ai-summary-branding {
    background: #f1f1f1;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 15px;
    margin: 20px 0;
    text-align: center;
}

.hdsoft-branding {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.hdsoft-upgrade-link {
    color: #0073aa;
    text-decoration: none;
    font-weight: 600;
}

.hdsoft-upgrade-link:hover {
    color: #005a87;
    text-decoration: underline;
}

/* Info Sections */
.hdsoft-ai-summary-info {
    margin-top: 30px;
}

.hdsoft-info-section {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.hdsoft-info-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #23282d;
    font-size: 16px;
    font-weight: 600;
}

.hdsoft-info-section p {
    margin-bottom: 10px;
    line-height: 1.5;
}

.hdsoft-info-section code {
    background: #f1f1f1;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: Consolas, Monaco, 'Courier New', monospace;
    font-size: 13px;
    color: #d63384;
}

.hdsoft-info-section pre {
    background: #f8f8f8;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    padding: 15px;
    overflow-x: auto;
    margin: 15px 0;
}

.hdsoft-info-section pre code {
    background: none;
    padding: 0;
    color: #333;
    font-size: 12px;
    line-height: 1.4;
}

.hdsoft-info-section ul {
    list-style-type: disc;
    margin-left: 20px;
    margin-bottom: 15px;
}

.hdsoft-info-section li {
    margin-bottom: 5px;
    line-height: 1.4;
}

/* Pro Features Section */
.hdsoft-pro-features {
    border-color: #00a32a;
    background: #f0f8f0;
}

.hdsoft-pro-features h3 {
    color: #00a32a;
}

.hdsoft-pro-features ul {
    list-style: none;
    margin-left: 0;
}

.hdsoft-pro-features li {
    color: #00a32a;
    font-weight: 500;
    margin-bottom: 8px;
}

.hdsoft-pro-features li:before {
    content: "✓ ";
    font-weight: bold;
    margin-right: 5px;
}

/* Form Field Enhancements */
.form-table th {
    width: 200px;
    padding: 20px 10px 20px 0;
    vertical-align: top;
}

.form-table td {
    padding: 15px 10px;
    vertical-align: top;
}

.form-table input[type="text"],
.form-table input[type="password"],
.form-table input[type="number"],
.form-table select {
    font-size: 14px;
}

.form-table .description {
    margin-top: 8px;
    font-style: italic;
    color: #666;
    line-height: 1.4;
}

/* Settings Sections */
.form-table h2 {
    margin: 30px 0 15px 0;
    padding: 10px 0;
    border-bottom: 1px solid #ccd0d4;
    color: #23282d;
    font-size: 18px;
}

/* API Key Field */
#openrouter_api_key {
    font-family: Consolas, Monaco, 'Courier New', monospace;
    letter-spacing: 1px;
}

/* Responsive Design */
@media screen and (max-width: 782px) {
    .hdsoft-info-section {
        padding: 15px;
    }
    
    .hdsoft-info-section pre {
        padding: 10px;
        font-size: 11px;
    }
    
    .form-table th,
    .form-table td {
        display: block;
        width: 100%;
        padding: 10px 0;
    }
    
    .form-table th {
        border-bottom: none;
        padding-bottom: 5px;
    }
    
    .hdsoft-ai-summary-branding {
        padding: 10px;
        margin: 15px 0;
    }
}

/* Loading States */
.hdsoft-loading {
    opacity: 0.6;
    pointer-events: none;
}

.hdsoft-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ccc;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: hdsoft-spin 1s linear infinite;
}

@keyframes hdsoft-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Notice Styles */
.hdsoft-notice {
    padding: 12px;
    margin: 15px 0;
    border-radius: 4px;
    border-left: 4px solid;
}

.hdsoft-notice.notice-success {
    background: #d1e7dd;
    border-left-color: #0f5132;
    color: #0f5132;
}

.hdsoft-notice.notice-error {
    background: #f8d7da;
    border-left-color: #842029;
    color: #842029;
}

.hdsoft-notice.notice-warning {
    background: #fff3cd;
    border-left-color: #856404;
    color: #856404;
}

.hdsoft-notice.notice-info {
    background: #d1ecf1;
    border-left-color: #0c5460;
    color: #0c5460;
}

/* Accessibility Improvements */
.hdsoft-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus States */
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .hdsoft-info-section {
        border-width: 2px;
    }
    
    .hdsoft-ai-summary-branding {
        border-width: 2px;
    }
    
    #connection-result.success {
        border-width: 2px;
    }
    
    #connection-result.error {
        border-width: 2px;
    }
}

/* Print Styles */
@media print {
    .hdsoft-ai-summary-branding,
    #test-connection,
    #connection-result {
        display: none;
    }
    
    .hdsoft-info-section {
        border: 1px solid #000;
        break-inside: avoid;
    }
}
