/**
 * RPKI Route Authority Checker - Custom Styles
 * 
 * @author AI Assistant
 * @version 1.0
 * @date 2025-01-18
 */

/* Global Styles */
body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.main-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

/* Header Styles */
.header-section {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border-radius: 10px 10px 0 0;
}

.header-section h1 {
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.header-section p {
    font-size: 1.1rem;
}

/* Form Styles */
.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
}

.btn-check {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
    padding: 12px 30px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-check:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40,167,69,0.3);
}

/* Card Styles */
.card {
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.card-header {
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
}

/* Result Styles */
.result-card {
    border-left: 4px solid #007bff;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.result-card:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.status-valid { 
    border-left-color: #28a745 !important; 
}

.status-invalid { 
    border-left-color: #dc3545 !important; 
}

.status-unknown { 
    border-left-color: #ffc107 !important; 
}

.status-error { 
    border-left-color: #6c757d !important; 
}

/* Debug Styles */
.debug-section {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
}

.api-call {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 5px;
    border-left: 4px solid #007bff;
}

.api-call.routinator { 
    background-color: #e3f2fd; 
    border-left-color: #2196f3;
}

.api-call.ripe { 
    background-color: #f3e5f5; 
    border-left-color: #9c27b0;
}

.api-call.cymru { 
    background-color: #e8f5e8; 
    border-left-color: #4caf50;
}

.api-call.error { 
    background-color: #ffebee; 
    border-left-color: #f44336;
}

.api-call.parsing {
    background-color: #fff3e0;
    border-left-color: #ff9800;
}

/* Code Styles */
pre {
    background-color: #2d3748;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 5px;
    font-size: 0.8em;
    max-height: 300px;
    overflow-y: auto;
    margin: 0;
    border: none;
}

pre::-webkit-scrollbar {
    width: 8px;
}

pre::-webkit-scrollbar-track {
    background: #4a5568;
}

pre::-webkit-scrollbar-thumb {
    background: #718096;
    border-radius: 4px;
}

pre::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Badge Styles */
.badge {
    font-size: 0.75em;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Statistics Cards */
.statistics-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1rem;
}

.statistics-card h4 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.statistics-card small {
    opacity: 0.9;
    font-size: 0.9rem;
}

/* Loading Styles */
.loading {
    display: none;
}

.loading.show {
    display: block;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Accordion Styles */
.accordion-button {
    font-weight: 600;
}

.accordion-button:not(.collapsed) {
    background-color: #e3f2fd;
    color: #1976d2;
}

.accordion-body {
    padding: 1.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-container {
        margin: 0.5rem;
        border-radius: 5px;
    }
    
    .header-section {
        border-radius: 5px 5px 0 0;
        padding: 2rem 1rem !important;
    }
    
    .header-section h1 {
        font-size: 1.5rem;
    }
    
    .btn-check {
        font-size: 0.9rem;
        padding: 10px 20px;
    }
    
    .statistics-card h4 {
        font-size: 2rem;
    }
    
    pre {
        font-size: 0.7em;
        max-height: 200px;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in-left {
    animation: slideInLeft 0.5s ease-out;
}

@keyframes slideInLeft {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.slide-in-right {
    animation: slideInRight 0.5s ease-out;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Utility Classes */
.text-shadow {
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.box-shadow-sm {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.box-shadow-md {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.box-shadow-lg {
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.border-gradient {
    border: 2px solid;
    border-image: linear-gradient(45deg, #007bff, #28a745) 1;
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    .debug-section {
        background-color: #343a40;
        border-color: #495057;
        color: #f8f9fa;
    }
    
    .api-call.routinator { 
        background-color: #1a365d; 
    }
    
    .api-call.ripe { 
        background-color: #44337a; 
    }
    
    .api-call.cymru { 
        background-color: #2f5233; 
    }
    
    .api-call.error { 
        background-color: #5c1b1b; 
    }
}

/* Table Detail Styles */
.table-detail-row {
    background-color: #f8f9fa !important;
    border-top: 0 !important;
}

.table-detail-content {
    max-width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    padding: 1.5rem;
}

.detail-section {
    display: inline-block;
    vertical-align: top;
    margin-right: 2rem;
    min-width: 300px;
    max-width: 450px;
    white-space: normal;
}

.detail-section:last-child {
    margin-right: 0;
}

.detail-section h6 {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.75rem;
    padding-bottom: 0.25rem;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

.detail-section pre {
    max-height: 250px;
    overflow-y: auto;
    font-size: 0.75rem;
    line-height: 1.3;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Results Table Styles */
.results-table {
    table-layout: fixed;
    width: 100%;
}

.results-table th,
.results-table td {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.results-table .ip-column {
    width: 35%;
}

.results-table .status-column {
    width: 20%;
    text-align: center;
}

.results-table .version-column {
    width: 15%;
    text-align: center;
}

.results-table .detail-column {
    width: 10%;
    text-align: center;
}

/* Ensure detail buttons stay visible */
.detail-toggle-btn {
    min-width: 36px;
    white-space: nowrap;
}

/* Responsive table details */
@media (max-width: 768px) {
    .detail-section {
        display: block;
        margin-right: 0;
        margin-bottom: 1.5rem;
        min-width: auto;
        max-width: none;
    }
    
    .table-detail-content {
        white-space: normal;
        overflow-x: visible;
    }
    
    .detail-section pre {
        font-size: 0.7rem;
        max-height: 200px;
    }
}

/* Print Styles */
@media print {
    .header-section {
        background: #007bff !important;
        -webkit-print-color-adjust: exact;
    }
    
    .btn, .card-header {
        display: none !important;
    }
    
    .main-container {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
    
    .table-detail-content {
        white-space: normal;
        overflow: visible;
    }
    
    .detail-section {
        display: block;
        margin-bottom: 1rem;
        page-break-inside: avoid;
    }
}
