/* ============================================
   BUNDESLIGA PORTAL - NEWS PORTAL STYLE
   Inspired by PHP-Fusion CMS Layout
   Error Logging: CSS loaded successfully
   ============================================ */

/* CSS Custom Properties */
:root {
    --bg-primary: #111827;
    --bg-secondary: #1F2937;
    --bg-tertiary: #283548;
    --accent-green: #22C55E;
    --accent-green-dark: #16A34A;
    --live-red: #EF4444;
    --text-primary: #F9FAFB;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    --border-color: #374151;
    --border-light: #4B5563;
    --gradient-green: linear-gradient(135deg, #22C55E 0%, #16A34A 100%);
    --gradient-header: linear-gradient(180deg, #1F2937 0%, #111827 100%);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 15px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

a {
    color: var(--accent-green);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--text-primary);
}

img {
    max-width: 100%;
    height: auto;
}

/* ============================================
   HEADER - Top Bar + Logo + Navigation
   ============================================ */

/* Top Bar */
.top-bar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 0;
    font-size: 0.8rem;
}

.top-bar-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: var(--text-secondary);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.top-bar a {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.top-bar a:hover {
    color: var(--accent-green);
}

/* Main Header */
.main-header {
    background: var(--gradient-header);
    border-bottom: 3px solid var(--accent-green);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.logo img {
    height: 60px;
    width: auto;
}

.logo-fallback {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.logo-fallback .icon {
    width: 50px;
    height: 50px;
    background: var(--gradient-green);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.logo-fallback span {
    color: var(--accent-green);
}

/* Header Info */
.header-info {
    flex: 1;
    text-align: center;
}

.header-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.header-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Header Right - Live Ticker Preview */
.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--live-red);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--live-red);
}

.live-dot {
    width: 8px;
    height: 8px;
    background: var(--live-red);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* Main Navigation */
.main-nav {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0;
    margin: 0;
    padding: 0;
}

.nav-menu li {
    position: relative;
    list-style: none;
}

.nav-menu li::marker {
    display: none;
    content: '';
}

.nav-menu a {
    display: block;
    padding: 1rem 1.25rem;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: rgba(34, 197, 94, 0.1);
    border-bottom-color: var(--accent-green);
    color: var(--accent-green);
}

.nav-menu a.active {
    background: rgba(34, 197, 94, 0.15);
}

/* Dropdown */
.nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 200;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-dropdown li {
    list-style: none;
}

.nav-dropdown li::marker {
    display: none;
    content: '';
}

.nav-menu li:hover .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown a {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.nav-dropdown a:last-child {
    border-bottom: none;
}

/* ============================================
   MAIN LAYOUT - Content + Sidebar
   ============================================ */

.page-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
}

/* Main Content Area */
.main-content {
    min-width: 0;
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ============================================
   PANELS - Reusable Box Components
   ============================================ */

.panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.panel-header {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border-bottom: 2px solid var(--accent-green);
    padding: 0.875rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-title {
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-title-icon {
    color: var(--accent-green);
}

.panel-actions {
    font-size: 0.75rem;
}

.panel-actions a {
    color: var(--text-secondary);
}

.panel-body {
    padding: 1rem;
}

.panel-body-flush {
    padding: 0;
}

/* ============================================
   NEWS / ARTICLE CARDS
   ============================================ */

.news-grid {
    display: grid;
    gap: 1.5rem;
}

.news-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.2s ease;
}

.news-card:hover {
    border-color: var(--accent-green);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.news-card-featured {
    grid-column: span 2;
}

.news-image {
    aspect-ratio: 16/9;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 3rem;
}

.news-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-content {
    padding: 1.25rem;
}

.news-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.news-category {
    background: var(--accent-green);
    color: var(--bg-primary);
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.65rem;
}

.news-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.news-title a {
    color: var(--text-primary);
}

.news-title a:hover {
    color: var(--accent-green);
}

.news-excerpt {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* News Placeholder */
.news-placeholder {
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
}

.news-placeholder-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.news-placeholder h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* News Home Grid - 1 Featured + 3 Small */
.news-home-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.news-home-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.2s ease;
}

.news-home-item:hover {
    border-color: var(--accent-green);
    transform: translateY(-2px);
}

/* Featured item spans full width */
.news-home-item.featured {
    grid-column: 1 / -1;
}

.news-home-item.featured .news-home-link {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 0;
}

.news-home-item.featured .news-home-image {
    aspect-ratio: 16/10;
}

.news-home-item.featured .news-home-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1.5rem;
}

.news-home-item.featured .news-home-title {
    font-size: 1.35rem;
    -webkit-line-clamp: 3;
}

.news-home-item.featured .news-home-date {
    margin-top: auto;
}

.news-home-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.news-home-image {
    aspect-ratio: 16/9;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.news-home-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.news-home-item:hover .news-home-image img {
    transform: scale(1.05);
}

.news-home-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--text-muted);
}

.news-home-content {
    padding: 1rem;
}

.news-home-category {
    display: inline-block;
    background: var(--accent-green);
    color: var(--bg-primary);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.6rem;
    margin-bottom: 0.5rem;
}

.news-home-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-home-date {
    font-size: 0.7rem;
    color: var(--text-muted);
}

@media (max-width: 1024px) {
    .news-home-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .news-home-item.featured {
        grid-column: 1 / -1;
    }
    
    .news-home-item.featured .news-home-link {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .news-home-grid {
        grid-template-columns: 1fr;
    }
    
    .news-home-item.featured {
        grid-column: span 1;
    }
    
    .news-home-item.featured .news-home-link {
        display: block;
    }
    
    .news-home-item.featured .news-home-content {
        padding: 1rem;
    }
    
    .news-home-item.featured .news-home-title {
        font-size: 1.1rem;
    }
}

/* ============================================
   TABLE STYLES
   ============================================ */

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th,
.data-table td {
    padding: 0.625rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.data-table tbody tr {
    transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
    background: rgba(34, 197, 94, 0.05);
}

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

/* Position Badges */
.pos-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.75rem;
}

.pos-1 { background: var(--gradient-green); color: white; }
.pos-cl { background: linear-gradient(135deg, #3B82F6, #2563EB); color: white; }
.pos-el { background: linear-gradient(135deg, #F97316, #EA580C); color: white; }
.pos-rel { background: linear-gradient(135deg, #EF4444, #DC2626); color: white; }
.pos-default { background: var(--bg-primary); color: var(--text-secondary); }

/* Team Cell */
.team-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.team-logo-sm {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.team-name {
    font-weight: 500;
    white-space: nowrap;
}

/* Stats */
.stat-center {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.stat-points {
    font-weight: 700;
    color: var(--accent-green);
}

.stat-positive { color: var(--accent-green); }
.stat-negative { color: var(--live-red); }

/* ============================================
   MATCH LIST STYLES
   ============================================ */

.match-list {
    display: flex;
    flex-direction: column;
}

.match-item {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s ease;
}

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

.match-item:hover {
    background: rgba(34, 197, 94, 0.05);
}

.match-team {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.match-team.away {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.match-team-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.match-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-width: 50px;
    padding: 0.35rem 0.5rem;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9rem;
}

.match-score.live {
    background: var(--live-red);
    animation: pulse-bg 2s infinite;
}

@keyframes pulse-bg {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.match-score.upcoming {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-color);
}

.match-date-header {
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
    background: var(--bg-secondary);
    border-top: 3px solid var(--accent-green);
    margin-top: 3rem;
}

.footer-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
}

.footer-col h4 {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 1rem;
    color: var(--accent-green);
}

.footer-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-col li {
    margin-bottom: 0.5rem;
    list-style: none;
}

.footer-col li::marker {
    display: none;
    content: '';
}

.footer-col a {
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

.footer-col a:hover {
    color: var(--accent-green);
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.footer-logo img {
    height: 40px;
}

.footer-about p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.6;
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding: 1rem;
}

.footer-bottom-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-legal {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-legal a {
    color: var(--text-muted);
}

.footer-legal a:hover {
    color: var(--accent-green);
}

/* Global list reset for navigation */
ul, ol {
    list-style-position: inside;
}

nav ul,
.nav-menu,
.nav-dropdown,
.footer-col ul,
.footer-legal {
    list-style-type: none;
    list-style: none;
    padding-left: 0;
}

/* ============================================
   LOADING & ERROR STATES
   ============================================ */

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 1rem;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.error-state {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--live-red);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
}

.error-state p {
    color: var(--live-red);
    margin-bottom: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--gradient-green);
    color: white;
}

.btn-primary:hover {
    filter: brightness(1.1);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .page-wrapper {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-main {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .header-info {
        order: -1;
    }
    
    .header-right {
        display: none;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .nav-menu a {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }
    
    .sidebar {
        grid-template-columns: 1fr;
    }
    
    .footer-main {
        grid-template-columns: 1fr;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }
    
    .news-card-featured {
        grid-column: span 1;
    }
    
    .top-bar {
        display: none;
    }
}

/* ============================================
   SCROLLBAR
   ============================================ */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   UTILITIES
   ============================================ */

/* Table Legend */
.table-legend {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-item .pos-badge {
    width: 16px;
    height: 16px;
    font-size: 0;
}

/* Utilities */
.text-accent { color: var(--accent-green); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
