/* ====================================
   Global Styles & Reset
   ==================================== */

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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background:  var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
}

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

/* ====================================
   Header
   ==================================== */

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #1d4ed8 100%);
    border-radius: var(--radius-lg);
    color: white;
    box-shadow: var(--shadow-lg);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

header .subtitle {
    font-size:  1.1rem;
    opacity: 0.9;
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: white;
    text-decoration: none;
    font-size: 1rem;
    transition: opacity 0.2s;
}

.back-link:hover {
    opacity:  0.8;
}

/* ====================================
   Cards
   ==================================== */

.show-totals,
.show-update {
	position: absolute;
	top: 0.7em;
	color: #fff;
	font-size: 0.8em;
	line-height: 1.2;
}
.show-totals {
	left: 1em;
	text-align: left;
}
.show-update {
	right: 1em;
	text-align: right;
}

.show-home,
.show-lock {
	position: absolute;
	bottom: 0.7em;
	color: #fff;
	font-size: 1.5em;
	line-height: 1.2;
}
.show-home {
	left: 0.6em;
	text-align: left;
}
.show-lock {
	right: 0.5em;
	text-align: right;
}

.search-card,
.info-card,
.detail-card,
.error-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.detail-card h2 {
	color: #0070C0;
	border-bottom: 1px solid var(--border-color);
	padding: 0;
	margin: 0;
	margin-top: -0.5em;
	margin-bottom: 20px;
}
.detail-card h2.brown { color: #996633; }
.detail-card h2.red { color: #e03e2d; }
.detail-card h2.blue { color: #0070C0; }
.card-journal {
	background: #ffffe6;
}
.card-category {
	background: #fdefe8;
}

.info-card {
    background: linear-gradient(to right, #f0f9ff 0%, #e0f2fe 100%);
    border-left: 4px solid var(--primary-color);
}

.info-card h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.info-card ul {
    list-style: none;
    padding-left: 0;
}
.info-card li {
    padding: 4px 0;
    padding-left: 25px;
    position: relative;
}
.info-card ul ul {
	list-style-type: circle;
	margin-left: 2.5em;
}
.info-card ul ul li {
	list-style-type: circle;
	padding-left: 5px;
}

/*
.info-card li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}
*/

.error-card {
    background: #fef2f2;
    border-left: 4px solid var(--danger-color);
    text-align: center;
}

.error-card h2 {
    color: var(--danger-color);
    margin-bottom: 15px;
}

/* ====================================
   Form Elements
   ==================================== */

.form-group {
    margin-bottom: 25px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight:  600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

input[type="text"],
select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius:  var(--radius-md);
    font-size: 1rem;
    transition: all 0.2s;
    background: white;
}

input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

select:disabled {
    background: #f1f5f9;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ====================================
   Autocomplete
   ==================================== */

.autocomplete-wrapper {
    position: relative;
}

.autocomplete-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border:  2px solid var(--primary-color);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    max-height: 400px;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    margin-top: -2px;
}

.autocomplete-results.active {
    display: block;
}

.autocomplete-item {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: fit-content; /* Pro horizontální scroll na mobilu */
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: #eff6ff;
}

.autocomplete-item .issn-col,
.autocomplete-item .eissn-col {
    font-weight: 600;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
}

.autocomplete-item .issn-col {
    width: 85px;
    text-align: left;
    flex-shrink: 0;
}

.autocomplete-item .eissn-col {
    width: 85px;
    text-align: left;
    flex-shrink: 0;
}

.autocomplete-item .pipe {
    color: var(--border-color);
    flex-shrink: 0;
}

.autocomplete-item .title-col {
    color: var(--text-primary);
    font-weight: 500;
    flex-grow: 1;
    white-space: nowrap;
    flex-shrink: 0; /* Nezkracovat název na mobilu */
}

.result-count {
    position: absolute;
    top: -28px;
    right: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.autocomplete-loading {
    padding: 12px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

/* Disabled field styling */
input[type="text"].disabled-by-category,
select.disabled-by-journal {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f1f5f9;
}

/* Exact match highlighting */
.autocomplete-item.exact-match {
    background: linear-gradient(to right, #d1fae5 0%, #a7f3d0 100%);
    border-left: 3px solid var(--success-color);
    font-weight: 600;
}

.autocomplete-item.exact-match:hover,
.autocomplete-item.exact-match.selected {
    background: linear-gradient(to right, #a7f3d0 0%, #6ee7b7 100%);
}

.autocomplete-item.exact-match .title-col {
    color: #065f46;
    font-weight: 600;
}

/* Mobile autocomplete - horizontální scroll */
@media (max-width: 768px) {
    .autocomplete-results {
        overflow-x: auto;
        overflow-y: auto;
    }
    
    .autocomplete-item {
        font-size: 0.8rem;
        padding: 8px 12px;
    }
    
    .autocomplete-item .issn-col {
        width: 75px;
    }
    
    .autocomplete-item .eissn-col {
        width: 75px;
    }
    
    .result-count {
        font-size: 0.75rem;
        top: -24px;
    }
}

/* ====================================
   Buttons
   ==================================== */

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.btn-primary,
.btn-secondary {
    padding: 12px 32px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background:  var(--primary-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-color);
    border-color: var(--secondary-color);
}

/* ====================================
   Journal Detail
   ==================================== */

.journal-detail h2 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom:  20px;
}

.journal-detail h3 {
    color: var(--text-primary);
    font-size: 1.4rem;
    margin-bottom:  15px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.journal-detail h4 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom:  10px;
    margin-top: 15px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.info-item {
    display: flex;
    flex-direction: column;
    padding: 15px;
    background: var(--bg-color);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary-color);
}

.info-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.info-value {
    font-size:  1.1rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* ====================================
   Categories
   ==================================== */

.categories-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.category-group {
    background: var(--bg-color);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.category-group ul {
    list-style: none;
    padding: 0;
}

.category-group li {
    padding: 8px 0;
    padding-left: 20px;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.category-group li:last-child {
    border-bottom: none;
}

.category-group li::before {
    content:  "•";
    position: absolute;
    left: 5px;
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.2rem;
}

/* Category Links */
.category-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    display: inline-block;
}

.category-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.category-group li a {
    padding-left: 0;
}

/* ====================================
   Tables
   ==================================== */

.table-wrapper,
.metrics-table-wrapper {
    overflow-x:  auto;
    margin-top: 20px;
}

.results-table,
.metrics-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.results-table thead,
.metrics-table thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1d4ed8 100%);
    color: white;
}

.results-table th,
.metrics-table th {
    padding: 15px 12px;
    text-align:  left;
    font-weight:  600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.results-table td,
.metrics-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.results-table tbody tr:hover {
    background: #f8fafc;
}

.results-table tbody tr:last-child td,
.metrics-table tbody tr:last-child td {
    border-bottom: none;
}

.col-number {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.col-center {
    text-align: center;
}

.col-title {
    font-weight: 500;
}

.col-publish {
    font-size: 0.8rem;
}
.pub-db { /* empty */ }
.pub-auto { color: #999999; }

.col-sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 25px;
}

.col-sortable:hover {
    background: rgba(255, 255, 255, 0.1);
}

.col-sortable .sort-icon::after {
    content: "⇅";
    position: absolute;
    right: 8px;
    opacity: 0.5;
    font-size: 0.9rem;
}

.col-sortable.sorted-asc .sort-icon::after {
    content: "↑";
    opacity: 1;
}

.col-sortable.sorted-desc .sort-icon::after {
    content: "↓";
    opacity: 1;
}

.journal-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.journal-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.jcr-link {
    display: inline-block;
    padding: 6px 12px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    transition: all 0.2s;
}

.jcr-link:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* WoS Rank styling */
.rank-mismatch {
    opacity: 0.5;
    font-style: italic;
    color: var(--text-secondary);
}

.rank-hidden {
    opacity: 0.3;
    cursor: help;
}

/* Primary metric highlighting */
.primary-metric {
    color: #dc2626;
    font-weight: 400;
}

.results-table tbody tr:hover .primary-metric {
    color: #b91c1c;
}

/* ====================================
   Quartile Badges
   ==================================== */

.quartile {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.85rem;
    text-align: center;
    min-width: 35px;
}

.quartile.qq1 {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.quartile.qq2 {
    background: #dbeafe;
    color: #1e40af;
    border:  1px solid #93c5fd;
}

.quartile.qq3 {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.quartile.qq4 {
    background: #fee2e2;
    color:  #991b1b;
    border:  1px solid #fca5a5;
}

.quartile.no-rank {
    opacity: 0.6;
    font-style: italic;
    border-style: dashed !important;
}

/* ====================================
   Year Badge
   ==================================== */

.year-badge {
    display:  inline-block;
    margin-left: 15px;
    padding: 6px 16px;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight:  600;
}

/* ====================================
   Results Header
   ==================================== */

.results-header {
    /*
	margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
	*/
}

.results-header h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.results-count {
    color: var(--text-secondary);
    font-size: 1rem;
}

.results-count strong {
    color: var(--primary-color);
    font-size: 1.2rem;
}

/* ====================================
   CSS Charts
   ==================================== */

.chart-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top:  2px solid var(--border-color);
}

.chart-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.chart {
    background: var(--bg-color);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.chart-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom:  15px;
    color:  var(--text-primary);
    text-align: center;
}

.chart-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chart-bar-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-label {
    min-width: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.chart-bar {
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    position: relative;
    min-width: 60px;
}

.chart-bar:hover {
    transform: scaleX(1.02);
    box-shadow: var(--shadow-md);
}

.if-bar {
    background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
}

.ais-bar {
    background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
}

.chart-value {
    color: white;
    font-weight: 700;
    font-size:  0.9rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ====================================
   Footer
   ==================================== */

footer {
    text-align: center;
    margin-top: 60px;
    padding:  30px 20px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

/* ====================================
   Responsive Design
   ==================================== */

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    header {
        padding: 30px 15px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    header .subtitle {
        font-size: 1rem;
    }

    .search-card,
    .info-card,
    .detail-card {
        padding: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .categories-section {
        grid-template-columns: 1fr;
    }

    .chart-container {
        grid-template-columns: 1fr;
    }

    /* Tabulky - horizontální scroll na mobilu */
    .table-wrapper,
    .metrics-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling na iOS */
    }
    
    .results-table,
    .metrics-table {
        min-width: 800px; /* Minimální šířka tabulky */
        font-size: 0.85rem;
    }

    .results-table th,
    .results-table td,
    .metrics-table th,
    .metrics-table td {
        padding: 8px 6px;
        font-size: 0.85rem;
    }

    .year-badge {
        display: block;
        margin-left: 0;
        margin-top: 10px;
        width: fit-content;
    }
}

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

    .autocomplete-results {
        font-size: 0.8rem;
    }

    .chart-bar {
        height: 28px;
    }

    .chart-label {
        min-width: 40px;
        font-size: 0.8rem;
    }

    .chart-value {
        font-size: 0.8rem;
    }
	
	/* Ještě menší tabulky na velmi malých displejích */
    .results-table,
    .metrics-table {
        min-width: 700px;
        font-size: 0.8rem;
    }
    
    .results-table th,
    .results-table td,
    .metrics-table th,
    .metrics-table td {
        padding:  6px 4px;
        font-size: 0.8rem;
    }
}

/* ====================================
   Loading States
   ==================================== */

.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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

/* ====================================
   Accessibility
   ==================================== */

*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus,
a:focus,
input:focus,
select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset:  2px;
}

/* ====================================
   Print Styles
   ==================================== */

@media print {
    .search-card,
    .info-card,
    footer,
    .back-link,
    .form-actions {
        display: none;
    }

    .detail-card,
    .results-table {
        box-shadow: none;
        border: 1px solid #000;
    }

    .chart-section {
        page-break-before: always;
    }
}

/* ====================================
   Screen Indicators
   ==================================== */

/* SCREEN SIZE INDICATOR */
	
	#screen-size-indicator {
		position: fixed;
		bottom: 10px;
		right: 10px;
		background: rgba(30, 30, 30, 0.8);
		color: #fff;
		font-size: 0.9em;
		padding: 0.4em 0.8em;
		border-radius: 6px;
		z-index: 9999;
		pointer-events: none; /* so it doesn't interfere with clicks */
		margin: 0;
		box-sizing: border-box;
		border: none;
	}

/* SCREEN RESIZE & WEBSITE VERSION BUTTONS */
	
	#screen-size-controls {
		position: fixed;
		bottom: 10px;
		left: 10px;
		display: flex;
		flex-direction: column;
		gap: 6px;
		z-index: 9999;
	}
	#screen-size-controls button,
	.bottom-button-row button {
		background: rgba(30, 30, 30, 0.8);
		color: #fff;
		border: none;
		padding: 0.4em 0.8em;
		font-size: 0.9em;
		border-radius: 6px;
		cursor: pointer;
		width: 100px; /* fixed width for all buttons */
		box-sizing: border-box;
	}
	@media (min-width: 769px) {
		#screen-size-controls #version-button { width: 110px; }
	}
	.bottom-button-row {
		display: flex;
		gap: 6px;
	}
	#button-tooltip.tooltip-box {
		visibility: hidden;
		opacity: 0;
		position: absolute;
		bottom: calc(100% + 10px); /* Adds 10px space above the button */
		left: 10px; /* 50% = horizontal anchor on button center */
		/*transform: translateX(-50%); /* Center tooltip */
		visibility: hidden;
		opacity: 0;
		transition: opacity 0.2s;
		padding: 8px 16px;
		background: orange; /* #222 or rgba(255, 165, 0, 1) */
		color: #fff;
		border-radius: 6px;
		white-space: nowrap;
		z-index: 10;
		font-size: 0.9em;
	}
	#button-tooltip.show {
		visibility: visible;
		opacity: 1;
	}
	/* Tooltip arrow */
	.tooltip-arrow {
		position: absolute;
		left: 10px;
		bottom: -7px; /* Place arrow at bottom left of tooltip */
		width: 0; 
		height: 0; 
		border-left: 7px solid transparent;
		border-right: 7px solid transparent;
		border-top: 7px solid orange; /* Matches tooltip background */
	}
	.mobile { display: none; }
	@media (max-width: 768px) {
		#mobile-window, .desktop { display: none; }
		.mobile { display: inline-block; }
		/*#pause-button { display: none; }*/
		#screen-size-controls #version-button { width: 100px; }
		.tooltip-arrow { bottom: -6px; }
	}

/* Přidání nových stylů pro upravené tabulky */

/* ====================================
   FORD Statistics Section
   ==================================== */

.border-stats {
	margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.ford-stats { background: linear-gradient(to right, #fef3c7 0%, #fde68a 100%); }
.legend-stats { background: linear-gradient(to right, #f3f4f6 0%, #d1d5db 100%); }

.ford-stats,
.legend-stats {
    border-left: 4px solid var(--secondary-color);
    padding: 15px 20px;
    margin-top: 15px;
    border-radius: var(--radius-md);
}

.ford-stats p,
.legend-stats p {
    margin: 5px 0;
    font-size: 0.95rem;
}
.legend-stats p.smaller {
	font-size: 0.8rem;
}

.ford-stats strong,
.legend-stats strong {
    color: var(--text-primary);
}

/* ====================================
   Highlight Metric (Primary Sorting Column)
   ==================================== */

.highlight-metric {
    background: linear-gradient(to right, #fee2e2 0%, #fecaca 100%);
    font-weight: 600;
    color: #991b1b;
}

.results-table tbody tr:hover .highlight-metric {
    background: linear-gradient(to right, #fecaca 0%, #fca5a5 100%);
    color: #7f1d1d;
}

/* ====================================
   Rank Dimmed (Non-Primary Sorting)
   ==================================== */

.rank-dimmed {
    opacity: 0.4;
    font-style: italic;
    color: var(--text-secondary);
}

/* ====================================
   Percentile Cell Styling
   ==================================== */

.percentile-cell {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ====================================
   D1 Badge (Top 10% Indicator)
   ==================================== */

.quartile.d1-badge {
    position: relative;
    overflow: visible;
}

/* Zvýrazněný pravý horní růžek pro D1 (decil) */
.quartile.d1-badge.star-style::after {
    content: '';
    position: absolute;
    top:  -1px;
    right: -1px;
	width: 16px;
	height: 16px;
	background: #00cc00;
	clip-path: polygon(100% 0, 100% 100%, 0 0);
	border-top-right-radius: 6px; /* zaoblení rohu */
    filter: drop-shadow(-1px 1px 1px rgba(0, 0, 0, 0.2));
}

/* Alternative:  Star icon for D1 */
.quartile.d1-badge::after {
    content: '★';
    position: absolute;
    top: -10px;
    right: -6px;
    font-size: 1rem;
    color: #f97316;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
    border:  none;
}

/* ====================================
   Zero AIS Section
   ==================================== */

.zero-ais-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 3px solid var(--border-color);
}

.zero-ais-section h3 {
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin-bottom: 20px;
    font-style: italic;
}

.zero-ais-table {
    opacity: 0.8;
}

.zero-ais-row {
    background: #fafafa;
}

.zero-ais-row:hover {
    background: #f5f5f5;
}

/* ====================================
   Table Column Widths (Optimization)
   ==================================== */

.wos-table th:nth-child(1),
.wos-table td:nth-child(1) {
    width: 50px; /* # */
}

.wos-table th:nth-child(2),
.wos-table td:nth-child(2) {
    width: 80px; /* IF Rank */
}

.wos-table th:nth-child(3),
.wos-table td:nth-child(3) {
    width: 80px; /* IF */
}

.wos-table th:nth-child(4),
.wos-table td:nth-child(4) {
    width: 60px; /* IF-Q */
}

.wos-table th:nth-child(5),
.wos-table td:nth-child(5) {
    width: 100px; /* ISSN */
}

.wos-table th:nth-child(7),
.wos-table td:nth-child(7) {
    width: 100px; /* eISSN */
}

. wos-table th:nth-child(8),
.wos-table td:nth-child(8) {
    width: 60px; /* AIS-Q */
}

.wos-table th:nth-child(9),
.wos-table td:nth-child(9) {
    width: 80px; /* AIS */
}

.wos-table th:nth-child(10),
.wos-table td:nth-child(10) {
    width: 90px; /* AIS Rank */
}

.ford-table th:nth-child(1),
.ford-table td:nth-child(1) {
    width: 50px; /* # */
}

.ford-table th:nth-child(2),
.ford-table td:nth-child(2) {
    width: 90px; /* AIS Rank */
}

.ford-table th:nth-child(3),
.ford-table td:nth-child(3) {
    width: 80px; /* AIS */
}

.ford-table th:nth-child(4),
.ford-table td:nth-child(4) {
    width: 70px; /* Perc. */
}

.ford-table th:nth-child(5),
.ford-table td:nth-child(5) {
    width: 60px; /* Q */
}

.ford-table th:nth-child(6),
.ford-table td:nth-child(6) {
    width: 100px; /* ISSN */
}

.ford-table th:nth-child(8),
.ford-table td:nth-child(8) {
    width: 100px; /* eISSN */
}

.ford-table th:nth-child(9),
.ford-table td:nth-child(9) {
    width: 80px; /* IF */
}

/* ====================================
   Responsive Adjustments for New Layout
   ==================================== */

@media (max-width: 768px) {
    .ford-stats,
	.legend-stats {
        font-size: 0.85rem;
        padding: 12px 15px;
    }
    
    .ford-stats p,
	.legend-stats p {
        font-size:  0.8rem;
    }
    
    .wos-table,
    .ford-table {
        min-width: 1000px;
    }
    
    .zero-ais-section h3 {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .ford-stats,
	.legend-stats {
        font-size:  0.8rem;
        padding: 10px 12px;
    }
    
    .quartile.d1-badge::after {
        border-width: 0 10px 10px 0;
    }
}

/* ====================================
   Category Ranking Section
   ==================================== */

.ranking-section {
    /*
	margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid var(--border-color);
	*/
}

.ranking-section h3 {
    color: var(--text-primary);
    font-size: 1.4rem;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
	/* text-align: center; */  /* ✅ PŘIDAT */
}

.ranking-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.ranking-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 15px;
    box-shadow: var(--shadow-sm);
}

.ranking-category-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 12px;
    text-align: center;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.ranking-table-wrapper {
    overflow-x: auto;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
	/* table-layout: fixed; */  /* ✅ PŘIDAT - vynutí rovnoměrné šířky */
}

.ranking-table thead {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    color: white;
}

.ranking-table th {
    padding: 8px 6px;
    text-align: center;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/*
.ranking-table .col-year { width: 15%; }
.ranking-table thead .col-if-group { width:  42.5%; }
.ranking-table thead .col-ais-group { width: 42.5%; }
*/

/* Explicitní šířky sloupců pro rovnoměrné rozložení */
.ranking-table .col-year {
    width: 60px;
    min-width: 60px;
}

.ranking-table thead tr:first-child .col-if-group {
    width: 40%; /* IF zabere 40% šířky */
}

.ranking-table thead tr:first-child .col-ais-group {
    width: 40%; /* AIS zabere 40% šířky */
}

/* Jednotlivé podsloupce - fixní šířka */
.ranking-table .subheader th:nth-child(2),  /* IF Rank */
.ranking-table .subheader th:nth-child(3),  /* IF Q */
.ranking-table .subheader th:nth-child(4),  /* IF % */
.ranking-table .subheader th:nth-child(5),  /* AIS Rank */
.ranking-table .subheader th:nth-child(6),  /* AIS Q */
.ranking-table .subheader th:nth-child(7) { /* AIS % */
    width: 40px;
    min-width: 40px;
}

.ranking-table .subheader th:nth-child(5) { /* IF % */
    width: 50px;
    min-width: 50px;
}

/* Aplikovat na TD buňky také */
.ranking-table tbody td:nth-child(1) { width: 60px; }   /* Year */
.ranking-table tbody td:nth-child(2) { width: 40px; }   /* IF Rank */
.ranking-table tbody td:nth-child(3) { width: 40px; }   /* IF Q */
.ranking-table tbody td:nth-child(4) { width: 40px; }   /* IF % */
.ranking-table tbody td:nth-child(5) { width: 40px; }   /* AIS Rank */
.ranking-table tbody td:nth-child(6) { width: 40px; }   /* AIS Q */
.ranking-table tbody td:nth-child(7) { width: 40px; }   /* AIS % */

.ranking-table thead tr:first-child th {
    padding: 10px 6px;
    font-size: 0.8rem;
}

.ranking-table .subheader th {
    background: #94a3b8;
    padding: 6px 4px;
    font-size: 0.7rem;
}

/* IF columns - light blue background */
.ranking-table .col-if-group {
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
}

.ranking-table .col-if {
    background: rgba(59, 130, 246, 0.08);
}

/* AIS columns - light green background */
.ranking-table .col-ais-group {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
}

.ranking-table .col-ais {
    background: rgba(16, 185, 129, 0.08);
}

.ranking-table td {
    padding: 6px 5px;
	text-align: center;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
}

.ranking-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

.ranking-table tbody tr:last-child td {
    border-bottom: none;
}

/* Latest year row highlighting */
.ranking-table tbody tr.latest-year {
    background: rgba(37, 99, 235, 0.05);
    font-weight: 600;
}

.ranking-table tbody tr.latest-year td {
    border-top: 2px solid var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.ranking-table tbody tr.latest-year:first-child td {
    border-top: none;
}

/* Column alignments */
.ranking-table .col-year {
    text-align: center;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.ranking-table .col-center {
    text-align: center;
}

.ranking-table .col-right {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Mini quartile badges for compact table */
.quartile-mini {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 700;
    font-size: 0.7rem;
    text-align: center;
    min-width: 25px;
}

.quartile-mini.qq1 {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.quartile-mini.qq2 {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.quartile-mini.qq3 {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.quartile-mini.qq4 {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* D1 badge for mini quartiles */
.quartile-mini.d1-badge {
    position: relative;
    overflow: visible;
}

.quartile-mini.d1-badge::after {
    content: '★';
    position: absolute;
    top: -8px;
    right: -5px;
    font-size: 0.7rem;
    color: #f97316;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
}

/* ====================================
   Responsive Design for Ranking
   ==================================== */

@media (max-width: 1024px) {
    .ranking-grid {
        grid-template-columns: 1fr;
    }
    
    .ranking-card {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .ranking-card {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}
    .ranking-card table {
		margin-bottom: 1rem; /* nebo třeba 10–20px podle potřeby */
	}
	.ranking-table {
        font-size: 0.75rem;
    }
    
    .ranking-table th,
    .ranking-table td {
        padding: 5px 3px;
    }
    
    .ranking-category-title {
        font-size: 0.85rem;
    }
    
    .quartile-mini {
        font-size: 0.65rem;
        padding: 1px 4px;
        min-width: 20px;
    }
}

@media (max-width: 480px) {
    .ranking-table {
        font-size: 0.7rem;
    }
    
    .ranking-table th {
        font-size: 0.65rem;
        padding: 4px 2px;
    }
    
    .ranking-table td {
        padding: 4px 2px;
    }
}

/* ====================================
   Ztmavení stránky
   ==================================== */

/* Poloprůhledné ztmavení celé stránky */
.page-overlay {
    position: fixed;
    /*top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;*/
	inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(2px);
    z-index: 50;
    display: none;
}

/* Aktivní blok musí být nad overlayem */

/* Výchozí stav – karty nemají speciální z-index */
.detail-card {
    position: relative;
}

/* Aktivní karta */
.detail-card.active-card {
	z-index: 200;
}
