/* SPD Ortsverein - Kandidaten Website
   Inspiriert vom SPD Corporate Design
   ================================== */

/* CSS Variables - SPD Farbpalette */
:root {
    --spd-red: #E3000F;
    --spd-red-dark: #B8000C;
    --spd-red-light: #FF1A29;
    --spd-blue: #008BCB;
    --white: #FFFFFF;
    --gray-100: #F5F5F5;
    --gray-200: #E8E8E8;
    --gray-300: #D1D1D1;
    --gray-600: #666666;
    --gray-800: #333333;
    --gray-900: #1A1A1A;
    --font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --max-width: 1200px;
    --header-height: 70px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--white);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

/* Container */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* ==================
   HEADER
   ================== */
.header {
    background-color: var(--white);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--header-height);
}

.header-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo a {
    display: flex;
    align-items: center;
}

.spd-logo {
    height: 40px;
    width: auto;
}

.nav {
    display: flex;
    gap: 30px;
}

.nav-link {
    font-weight: 600;
    color: var(--gray-800);
    padding: 8px 0;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background-color: var(--spd-red);
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-link:hover,
.nav-link.active {
    color: var(--spd-red);
}

/* Back Button (Kandidaten-Seiten) */
.back-button {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--spd-red);
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.back-button:hover {
    background-color: var(--gray-100);
}

.back-button svg {
    flex-shrink: 0;
}

/* ==================
   HERO SECTION
   ================== */
.hero {
    background: linear-gradient(135deg, var(--spd-red) 0%, var(--spd-red-dark) 100%);
    color: var(--white);
    padding: 60px 20px;
    text-align: center;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero-text {
    font-size: 1.125rem;
    line-height: 1.8;
    opacity: 0.95;
}

/* ==================
   CANDIDATES SECTION
   ================== */
.candidates-section {
    padding: 60px 20px;
    background-color: var(--gray-100);
    flex: 1;
}

.section-title {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 40px;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background-color: var(--spd-red);
    margin: 15px auto 0;
    border-radius: 2px;
}

/* Kandidaten Grid */
.candidates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 25px;
    max-width: var(--max-width);
    margin: 0 auto;
}

/* Kandidaten Card */
.candidate-card {
    background-color: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: block;
}

.candidate-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.candidate-image {
    position: relative;
    padding-top: 100%; /* 1:1 Aspect Ratio für Thumbnails */
    background-color: var(--gray-200);
    overflow: hidden;
}

.candidate-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.candidate-card:hover .candidate-image img {
    transform: scale(1.05);
}

.candidate-info {
    padding: 15px;
    text-align: center;
    border-top: 3px solid var(--spd-red);
    position: relative;
}

/* Listennummer Badge auf der Karte */
.candidate-number {
    display: inline-block;
    background-color: var(--spd-red);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 700;
    width: 24px;
    height: 24px;
    line-height: 24px;
    border-radius: 50%;
    margin-bottom: 8px;
}

.candidate-info h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.candidate-role {
    font-size: 0.875rem;
    color: var(--gray-600);
    line-height: 1.4;
}

/* ==================
   CANDIDATE DETAIL PAGE
   ================== */
.candidate-page .header-container {
    justify-content: flex-start;
    gap: 20px;
}

.candidate-page .logo {
    margin-left: auto;
}

.candidate-main {
    flex: 1;
    background-color: var(--gray-100);
    padding-bottom: 40px;
}

.candidate-header {
    background: linear-gradient(135deg, var(--spd-red) 0%, var(--spd-red-dark) 100%);
    color: var(--white);
    padding: 40px 20px;
    text-align: center;
}

.candidate-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

/* Große Listennummer auf Detailseite */
.candidate-number-large {
    display: inline-block;
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--white);
    font-size: 1.5rem;
    font-weight: 700;
    width: 50px;
    height: 50px;
    line-height: 50px;
    border-radius: 50%;
    margin-bottom: 15px;
    border: 2px solid rgba(255, 255, 255, 0.4);
}

.candidate-details {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    line-height: 1.6;
    max-width: 700px;
    margin: 0 auto 15px;
}

.candidate-quote {
    color: var(--white);
    font-size: 1.125rem;
    font-style: italic;
    max-width: 600px;
    margin: 0 auto;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.candidate-header .candidate-role {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.125rem;
}

/* ==================
   GALLERY
   ================== */
.candidate-gallery {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-container {
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.gallery-track {
    display: flex;
    transition: transform 0.3s ease;
}

.gallery-slide {
    flex: 0 0 100%;
    min-width: 100%;
}

.gallery-slide img {
    width: 100%;
    height: auto;
    display: block;
}

/* Pagination Dots (Mobile) */
.gallery-pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.gallery-pagination .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--gray-300);
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.gallery-pagination .dot.active {
    background-color: var(--spd-red);
    transform: scale(1.2);
}

.gallery-pagination .dot:hover {
    background-color: var(--spd-red-light);
}

/* Gallery Navigation Buttons (Mobile) */
.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.9);
    color: var(--spd-red);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: opacity 0.2s ease, background-color 0.2s ease;
    z-index: 10;
}

.gallery-nav:hover {
    background-color: var(--white);
}

.gallery-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.gallery-nav-prev {
    left: 10px;
}

.gallery-nav-next {
    right: 10px;
}

.gallery-nav svg {
    width: 20px;
    height: 20px;
}

/* Desktop: Buttons ausblenden */
@media (min-width: 768px) {
    .gallery-nav {
        display: none;
    }
}

/* Desktop: Drei Bilder nebeneinander */
@media (min-width: 768px) {
    .gallery-track {
        display: flex;
        gap: 0;
    }

    .gallery-slide {
        flex: 1;
        min-width: 0;
    }

    .gallery-pagination {
        display: none;
    }

    /* Keine Transitions auf Desktop */
    .gallery-track {
        transition: none;
        transform: none !important;
    }
}

/* ==================
   FOOTER
   ================== */
.footer {
    background-color: var(--gray-900);
    color: var(--white);
    padding: 40px 20px 20px;
    margin-top: auto;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    margin-bottom: 30px;
}

.footer-logo {
    text-align: center;
}

.spd-logo-footer {
    height: 35px;
    width: auto;
    margin-bottom: 10px;
}

.footer-logo p {
    color: var(--gray-300);
    font-size: 0.875rem;
}

.footer-links {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: var(--gray-300);
    font-size: 0.875rem;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--white);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--gray-800);
}

.footer-bottom p {
    color: var(--gray-600);
    font-size: 0.8rem;
}

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

/* Tablet */
@media (min-width: 600px) {
    .hero h1 {
        font-size: 3rem;
    }

    .candidates-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }

    .footer-content {
        flex-direction: row;
        justify-content: space-between;
    }

    .footer-logo {
        text-align: left;
    }
}

/* Desktop */
@media (min-width: 900px) {
    .hero {
        padding: 80px 20px;
    }

    .hero h1 {
        font-size: 3.5rem;
    }

    .candidates-section {
        padding: 80px 20px;
    }

    .candidates-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 30px;
    }

    .candidate-header {
        padding: 50px 20px;
    }

    .candidate-header h1 {
        font-size: 2.5rem;
    }

    .candidate-gallery {
        padding: 40px 20px;
    }
}

/* Large Desktop */
@media (min-width: 1200px) {
    .candidates-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Mobile Optimierungen */
@media (max-width: 599px) {
    :root {
        --header-height: 60px;
    }

    .spd-logo {
        height: 32px;
    }

    .back-button span {
        display: none;
    }

    .back-button {
        padding: 8px;
    }

    .hero {
        padding: 40px 15px;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .hero-text {
        font-size: 1rem;
    }

    .candidates-section {
        padding: 40px 15px;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .candidates-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .candidate-info {
        padding: 12px;
    }

    .candidate-info h3 {
        font-size: 0.9rem;
    }

    .candidate-role {
        font-size: 0.8rem;
    }

    .candidate-header {
        padding: 30px 15px;
    }

    .candidate-header h1 {
        font-size: 1.5rem;
    }

    .candidate-gallery {
        padding: 15px;
    }

    .footer {
        padding: 30px 15px 15px;
    }

    .footer-links {
        gap: 20px;
    }
}

/* Touch-Optimierungen für mobile Geräte */
@media (hover: none) and (pointer: coarse) {
    .candidate-card:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }

    .candidate-card:active {
        transform: scale(0.98);
    }

    .gallery-track {
        cursor: grab;
    }

    .gallery-track:active {
        cursor: grabbing;
    }
}

/* Coming Soon Overlay für Kandidaten ohne Bilder */
.candidate-card.coming-soon .candidate-image::after {
    content: 'Bild folgt';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--spd-red) 0%, var(--spd-red-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.candidate-card.coming-soon .candidate-image img {
    display: none;
}

/* Coming Soon auf Detailseite */
.gallery-coming-soon {
    background: linear-gradient(135deg, var(--spd-red) 0%, var(--spd-red-dark) 100%);
    border-radius: 8px;
    padding: 80px 40px;
    text-align: center;
    color: var(--white);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.gallery-coming-soon h2 {
    font-size: 2rem;
    margin-bottom: 15px;
}

.gallery-coming-soon p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Placeholder für fehlende Bilder */
.candidate-image img[src=""],
.candidate-image img:not([src]),
.gallery-slide img[src=""],
.gallery-slide img:not([src]) {
    background: linear-gradient(135deg, var(--gray-200) 0%, var(--gray-300) 100%);
}

/* Broken Image Fallback */
.candidate-image img::before,
.gallery-slide img::before {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--gray-200) 0%, var(--gray-300) 100%);
}

/* ==================
   LEGAL PAGES (Impressum, Datenschutz)
   ================== */
.legal-page {
    flex: 1;
    padding: 60px 20px;
    background-color: var(--white);
}

.legal-page .container {
    max-width: 800px;
}

.legal-page h1 {
    font-size: 2.5rem;
    color: var(--spd-red);
    margin-bottom: 40px;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--spd-red);
}

.legal-page h2 {
    font-size: 1.25rem;
    color: var(--gray-900);
    margin-top: 35px;
    margin-bottom: 15px;
}

.legal-page h3 {
    font-size: 1.1rem;
    color: var(--gray-800);
    margin-top: 25px;
    margin-bottom: 10px;
}

.legal-page p {
    margin-bottom: 15px;
    line-height: 1.7;
}

.legal-page ul {
    margin: 15px 0;
    padding-left: 25px;
}

.legal-page li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.legal-page em {
    color: var(--gray-600);
}

@media (max-width: 599px) {
    .legal-page {
        padding: 40px 15px;
    }

    .legal-page h1 {
        font-size: 1.75rem;
    }

    .legal-page h2 {
        font-size: 1.1rem;
    }
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .back-button,
    .gallery-pagination {
        display: none;
    }

    .candidate-gallery {
        page-break-inside: avoid;
    }

    .gallery-track {
        display: flex !important;
    }

    .gallery-slide {
        flex: 1 !important;
        min-width: 0 !important;
    }
}
