/* Custom styles for the static Name Search Application */

/* Sticky navbar styles */
.navbar.fixed-top {
    transition: box-shadow 0.3s ease;
    z-index: 1050;
}

.navbar.fixed-top.scrolled {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px; /* Increased from 70px to ensure enough padding */
}

/* Add top margin to main content containers */
.dashboard-container, .hero-section {
    margin-top: 70px;
}

/* Fix for action bar with back and share buttons */
.action-bar {
    position: relative;
    margin-top: 80px; /* Increased from 60px to ensure it's fully visible */
    z-index: 1040; /* Lower than navbar but higher than most content */
}

/* Mobile adjustments for action bar */
@media (max-width: 768px) {
    .action-bar {
        margin-top: 70px; /* Slightly less on mobile as navbar might be smaller */
    }
}

/* Loading states */
.btn .spinner-border {
    width: 1rem;
    height: 1rem;
}

/* Highlighted search results */
.highlighted-text {
    position: relative;
}

.highlighted-text mark {
    background-color: #ffc107 !important;
    color: #000 !important;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-weight: 500;
}

/* Card hover effects */
.card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

/* Search form enhancements */
.form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Results styling */
.table td {
    padding: 0.5rem;
    vertical-align: top;
}

.table td:first-child {
    white-space: nowrap;
}

/* Details element styling */
details summary {
    cursor: pointer;
    user-select: none;
}

details summary:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

details[open] summary {
    margin-bottom: 0.5rem;
}

/* Badge styling */
.badge {
    font-size: 0.75em;
}

/* JSON code blocks */
pre {
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.875rem;
    line-height: 1.4;
    background-color: #1a1a1a !important;
    color: #f8f9fa !important;
    border: 1px solid #495057;
}

/* Alert styling */
.alert {
    border: none;
    border-radius: 0.5rem;
}

.alert-success {
    background-color: rgba(25, 135, 84, 0.1);
    border-left: 4px solid #198754;
    color: #75b798;
}

.alert-info {
    background-color: rgba(13, 202, 240, 0.1);
    border-left: 4px solid #0dcaf0;
    color: #7dd3fc;
}

.alert-warning {
    background-color: rgba(255, 193, 7, 0.1);
    border-left: 4px solid #ffc107;
    color: #ffeeba;
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.1);
    border-left: 4px solid #dc3545;
    color: #f8d7da;
}

/* Icon spacing */
.fa {
    line-height: inherit;
}

/* Dark theme specific adjustments */
[data-bs-theme="dark"] {
    --bs-body-bg: #1a1a1a;
    --bs-body-color: #e9ecef;
}

[data-bs-theme="dark"] .card {
    background-color: #2d2d2d;
    border-color: #495057;
}

[data-bs-theme="dark"] .form-control {
    background-color: #343a40;
    border-color: #495057;
    color: #e9ecef;
}

[data-bs-theme="dark"] .form-control:focus {
    background-color: #495057;
    border-color: #0d6efd;
    color: #e9ecef;
}

[data-bs-theme="dark"] .btn-outline-secondary {
    color: #adb5bd;
    border-color: #495057;
}

[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background-color: #495057;
    border-color: #6c757d;
    color: #fff;
}

/* Loading animation */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Search result animations */
.result-card {
    animation: fadeInUp 0.3s ease-out forwards;
    opacity: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger animation for multiple results */
.result-card:nth-child(1) { animation-delay: 0.1s; }
.result-card:nth-child(2) { animation-delay: 0.2s; }
.result-card:nth-child(3) { animation-delay: 0.3s; }
.result-card:nth-child(4) { animation-delay: 0.4s; }
.result-card:nth-child(5) { animation-delay: 0.5s; }

/* Responsive adjustments */
@media (max-width: 768px) {
    .display-4 {
        font-size: 2rem;
    }
    
    .display-6 {
        font-size: 1.5rem;
    }
    
    .card-header .d-flex {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
}

/* Smooth transitions */
* {
    transition: background-color 0.15s ease-in-out, 
                border-color 0.15s ease-in-out, 
                color 0.15s ease-in-out;
}

/* Focus indicators for accessibility */
.btn:focus,
.form-control:focus,
.btn-close:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* Gender distribution styling */
.gender-stat {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.gender-stat.male {
    border-left: 4px solid #0d6efd;
}

.gender-stat.female {
    border-left: 4px solid #dc3545;
}

/* Trend chart styling */
.trend-year {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.trend-count.positive {
    color: #198754;
}

.trend-count.zero {
    color: #6c757d;
}

/* State distribution styling */
.state-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Dashboard Styles */
.dashboard-container {
    background: #2d2d2d;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid #495057;
}

.dashboard-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin: -2rem -2rem 2rem -2rem;
    color: white;
}

.name-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    color: white;
}

.name-badges .badge {
    margin-right: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.badge-gender {
    background: #4285f4 !important;
}

.badge-rarity {
    background: #db4437 !important;
}

.badge-year {
    background: #0f9d58 !important;
}

.lucky-number-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

.lucky-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
}

.lucky-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
}

.stat-card {
    background: #343a40;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid #495057;
    height: 100%;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #4285f4;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #adb5bd;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chart-card {
    background: #343a40;
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid #495057;
    height: 100%;
}

.chart-title {
    color: #4285f4;
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 1rem;
}

.rarity-description {
    color: #e9ecef;
    font-size: 0.9rem;
    line-height: 1.5;
    background: rgba(66, 133, 244, 0.1);
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid #4285f4;
}

.rarity-visual {
    margin-top: 1rem;
}

.rarity-bar {
    height: 20px;
    background: #495057;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.rarity-fill {
    height: 100%;
    background: linear-gradient(90deg, #db4437 0%, #f4b400 50%, #0f9d58 100%);
    transition: width 0.8s ease;
}

.rarity-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #adb5bd;
}

.characteristics-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.char-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.char-label {
    min-width: 80px;
    font-size: 0.875rem;
    color: #adb5bd;
}

.char-bar {
    flex: 1;
    height: 8px;
    background: #495057;
    border-radius: 4px;
    overflow: hidden;
}

.char-fill {
    height: 100%;
    background: linear-gradient(90deg, #4285f4, #0f9d58);
    transition: width 0.8s ease;
}

.char-value {
    min-width: 40px;
    font-size: 0.875rem;
    color: #e9ecef;
    font-weight: 600;
}

/* Chart containers */
canvas {
    max-height: 300px !important;
}

/* Table styles for dashboard */
.table-responsive {
    background: #343a40;
    border-radius: 8px;
}

.table {
    color: #e9ecef;
    margin-bottom: 0;
}

.table thead th {
    border-color: #495057;
    background: #495057;
    color: #e9ecef;
    font-weight: 600;
}

.table tbody tr {
    border-color: #495057;
}

.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Progress bars */
.progress {
    background: #495057;
}

.progress-bar {
    background: linear-gradient(90deg, #4285f4, #0f9d58) !important;
}

/* Responsive adjustments for dashboard */
@media (max-width: 768px) {
    .dashboard-container {
        padding: 1rem;
    }
    
    .dashboard-header {
        margin: -1rem -1rem 1rem -1rem;
        padding: 1rem;
    }
    
    .name-title {
        font-size: 1.8rem;
    }
    
    .lucky-number-circle {
        width: 60px;
        height: 60px;
    }
    
    .lucky-number {
        font-size: 1.2rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .characteristics-grid {
        gap: 0.75rem;
    }
    
    .char-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .char-label {
        min-width: auto;
    }
}

/* Animation for dashboard elements */
.dashboard-container {
    animation: slideInUp 0.6s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chart loading states */
.chart-card canvas {
    transition: opacity 0.3s ease;
}

.chart-loading {
    opacity: 0.5;
}

/* Utility classes */
.cursor-pointer {
    cursor: pointer;
}

.user-select-none {
    user-select: none;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}