/* Baby Names Explorer - Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    padding: 30px 0;
}

header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 10px;
}

.subtitle {
    color: #7f8c8d;
    font-size: 1.1rem;
}

/* Main Layout */
.main-content {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
}

/* Filters Sidebar */
.filters {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.filters h2 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: #2c3e50;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group > label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group input[type="text"],
.filter-group input[type="number"],
.filter-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.button-group {
    display: flex;
    gap: 8px;
}

.filter-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: #f8f9fa;
}

.filter-btn.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.range-inputs input {
    flex: 1;
    width: auto;
}

.range-inputs span {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.95rem;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.reset-btn {
    width: 100%;
    padding: 12px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.2s;
}

.reset-btn:hover {
    background: #c0392b;
}

/* Results Area */
.results-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Chart Section */
.chart-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.chart-header h2 {
    font-size: 1.2rem;
    color: #2c3e50;
}

.chart-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.chart-controls input {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.chart-controls label {
    color: #7f8c8d;
}

.chart-mode-toggle {
    display: flex;
    background: #e9ecef;
    border-radius: 6px;
    padding: 2px;
    margin-right: 12px;
}

.mode-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #7f8c8d;
    transition: all 0.2s;
}

.mode-btn:hover {
    color: #2c3e50;
}

.mode-btn.active {
    background: white;
    color: #3498db;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.clear-btn {
    padding: 6px 12px;
    background: #95a5a6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.clear-btn:hover {
    background: #7f8c8d;
}

.chart-container {
    position: relative;
    height: 300px;
}

.chart-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #bdc3c7;
    font-size: 1rem;
}

.selected-names {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
    min-height: 32px;
}

.name-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f8f9fa;
    border: 2px solid;
    border-radius: 20px;
    font-size: 0.9rem;
}

.remove-chip {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: #7f8c8d;
    padding: 0;
    line-height: 1;
}

.remove-chip:hover {
    color: #e74c3c;
}

/* Table Section */
.table-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.table-header h2 {
    font-size: 1.2rem;
    color: #2c3e50;
}

.table-header h2 span {
    font-weight: normal;
    color: #7f8c8d;
    font-size: 0.9rem;
}

.pagination-info {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

th.sortable {
    cursor: pointer;
    position: relative;
    padding-right: 20px;
}

th.sortable:hover {
    background: #e9ecef;
}

th.sortable::after {
    content: '';
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.3;
    border: 4px solid transparent;
    border-top: 5px solid #2c3e50;
    margin-top: 3px;
}

th.sortable.sort-asc::after {
    opacity: 1;
    border-top: 5px solid #3498db;
}

th.sortable.sort-desc::after {
    opacity: 1;
    border-top: none;
    border-bottom: 5px solid #3498db;
    margin-top: -3px;
}

tr {
    cursor: pointer;
    transition: background 0.2s;
}

tr:hover {
    background: #f8f9fa;
}

tr.selected {
    background: #ebf5fb;
}

tr.selected:hover {
    background: #d4e6f1;
}

.name-cell {
    font-weight: 600;
    color: #2c3e50;
}

.gender-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.gender-F {
    background: #fdeaea;
    color: #e74c3c;
}

.gender-M {
    background: #e8f4fc;
    color: #3498db;
}

.trend-up {
    color: #27ae60;
}

.trend-down {
    color: #e74c3c;
}

.trend-stable {
    color: #7f8c8d;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 5px;
    text-transform: uppercase;
}

.badge-upswing {
    background: #d5f5e3;
    color: #27ae60;
}

.badge-comeback {
    background: #fdebd0;
    color: #e67e22;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.pagination button {
    padding: 8px 16px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.pagination button:hover:not(:disabled) {
    background: #2980b9;
}

.pagination button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

#page-info {
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .filters {
        position: static;
    }

    .chart-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 600px) {
    header h1 {
        font-size: 1.8rem;
    }

    .button-group {
        flex-direction: column;
    }

    th, td {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
}

