/**
 * Responsive Fixes für Klick-Game
 * Behebt Layout-Probleme und macht das Design vollständig responsive
 */

/* ===== GLOBAL RESPONSIVE FIXES ===== */

* {
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-color: #2a2a2a;
}

body {
    font-family: 'Roboto', 'Arial', sans-serif;
    background-image: url('/images/body-bg.jpg');
    background-attachment: fixed;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-color: #2a2a2a;
    color: #BAB3B4;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* Container - Relative sizes */
.container, 
.site-container {
    max-width: 100%;
    width: 100%;
    padding: 0 1rem;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .container,
    .site-container {
        max-width: 750px;
    }
}

@media (min-width: 992px) {
    .container,
    .site-container {
        max-width: 970px;
    }
}

@media (min-width: 1200px) {
    .container,
    .site-container {
        max-width: 1170px;
    }
}

@media (min-width: 1400px) {
    .container,
    .site-container {
        max-width: 1320px;
    }
}

/* ===== LAYOUT GRID SYSTEM ===== */

.site-content {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas: 
        "main"
        "left"
        "right";
    gap: 1rem;
    width: 100%;
    min-height: calc(100vh - 20rem);
}

.site-content-left {
    grid-area: left;
}

.site-content-main {
    grid-area: main;
    min-width: 0;
}

.site-content-right {
    grid-area: right;
}

/* Desktop Layout - 3 Columns with sticky sidebars */
@media (min-width: 992px) {
    .site-content {
        grid-template-columns: minmax(12rem, 15rem) 1fr minmax(12rem, 15rem);
        grid-template-areas: "left main right";
        gap: 1.5rem;
    }
    
    /* Sticky sidebars on desktop */
    .site-content-left,
    .site-content-right {
        position: sticky;
        top: 1rem;
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
        align-self: start;
    }
    
    /* Custom scrollbar for sidebars */
    .site-content-left::-webkit-scrollbar,
    .site-content-right::-webkit-scrollbar {
        width: 0.5rem;
    }
    
    .site-content-left::-webkit-scrollbar-track,
    .site-content-right::-webkit-scrollbar-track {
        background: #444;
    }
    
    .site-content-left::-webkit-scrollbar-thumb,
    .site-content-right::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 0.25rem;
    }
    
    .site-content-left::-webkit-scrollbar-thumb:hover,
    .site-content-right::-webkit-scrollbar-thumb:hover {
        background: #aaa;
    }
}

@media (min-width: 1200px) {
    .site-content {
        grid-template-columns: minmax(13rem, 16rem) 1fr minmax(13rem, 16rem);
    }
}

@media (min-width: 1400px) {
    .site-content {
        grid-template-columns: minmax(14rem, 18rem) 1fr minmax(14rem, 18rem);
    }
}

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

.site-footer {
    width: 100%;
    max-width: 90rem;
    margin: 1.25rem auto 0;
    padding: 1rem;
    background: rgba(114, 107, 108, 0.8);
    border-top: 2px solid #ff6600;
}

/* ===== HIGHSCORE RESPONSIVE FIXES ===== */

.highscore-container {
    background: #726B6C;
    border: 2px solid #ff6600;
    border-radius: 0.5rem;
    margin: 1rem 0;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    max-width: 100%;
}

.highscore-header {
    background: linear-gradient(135deg, #726B6C 0%, #595959 100%);
    padding: 1rem;
    border-bottom: 2px dashed #328727;
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr);
    gap: 0.5rem;
    align-items: center;
    font-weight: bold;
    color: #FFFFFF;
    text-align: center;
}

.highscore-row {
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr);
    gap: 0.5rem;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #595959;
    transition: background-color 0.2s ease;
}

/* Mobile Highscore */
@media (max-width: 992px) {
    .highscore-header {
        display: none;
    }
    
    .highscore-row {
        grid-template-columns: 1fr;
        padding: 1rem;
        margin-bottom: 0.5rem;
        border: 2px solid #595959;
        border-radius: 0.5rem;
    }
    
    .highscore-col {
        text-align: left !important;
        padding: 0.25rem 0;
    }
    
    .highscore-col:before {
        content: attr(data-label) ": ";
        font-weight: bold;
        color: #E7E7E7;
        display: inline-block;
        min-width: 120px;
    }
    
    .highscore-col:first-child:before {
        content: "";
        display: none;
    }
}

/* ===== GEWINNSPIEL (RAFFLE) RESPONSIVE FIXES ===== */

.gewinn-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 1rem;
}

.gewinn-section {
    background: linear-gradient(135deg, #726B6C 0%, #595959 100%);
    border: 2px solid #ff6600;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.gewinn-title {
    color: #fff;
    font-size: 1.25rem;
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px dashed #328727;
    font-weight: bold;
}

/* Mobile Gewinnspiel */
@media (max-width: 768px) {
    .gewinn-container {
        padding: 0.5rem;
    }
    
    .gewinn-section {
        padding: 1rem;
    }
    
    .gewinn-title {
        font-size: 1.125rem;
    }
    
    .gewinn-table {
        display: block;
        overflow-x: auto;
    }
}

/* ===== PINNWAND RESPONSIVE FIXES ===== */

.pinnwand-container {
    background: #726B6C;
    border: 2px solid #ff6600;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    max-width: 100%;
}

.pinnwand-header {
    background: linear-gradient(135deg, #726B6C 0%, #595959 100%);
    color: #FFFFFF;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px dashed #328727;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Mobile Pinnwand */
@media (max-width: 768px) {
    .pinnwand-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.5rem;
    }
    
    .pinnwand-content {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
    
    .pinnwand-avatar {
        max-width: 60px;
        float: none;
        margin: 0 auto 0.5rem;
        display: block;
    }
}

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

h1, .kg-h1 {
    font-size: clamp(1.5rem, 5vw, 2rem);
}

h2, .kg-h2 {
    font-size: clamp(1.25rem, 4vw, 1.75rem);
}

h3, .kg-h3 {
    font-size: clamp(1.125rem, 3vw, 1.5rem);
}

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

.btn,
.kg-btn,
button,
input[type="submit"],
input[type="button"] {
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
}

@media (max-width: 767px) {
    .btn,
    .kg-btn,
    button,
    input[type="submit"],
    input[type="button"] {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

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

.kg-table,
.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
}

@media (max-width: 767px) {
    .kg-table thead {
        display: none;
    }
    
    .kg-table,
    .kg-table tbody,
    .kg-table tr,
    .kg-table td {
        display: block;
        width: 100%;
    }
    
    .kg-table tr {
        margin-bottom: 1rem;
        border: 1px solid #595959;
        border-radius: 0.25rem;
    }
    
    .kg-table td {
        text-align: right;
        padding-left: 50%;
        position: relative;
        border: none;
        border-bottom: 1px solid #595959;
    }
    
    .kg-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        padding-left: 0.75rem;
        font-weight: bold;
        text-align: left;
    }
}

/* ===== SIDEBAR FIXES ===== */

.sidebar {
    background-color: #021B40;
    border-radius: 0.3125rem;
    overflow: hidden;
    margin-bottom: 1.25rem;
}

@media (min-width: 992px) {
    .sidebar {
        margin-bottom: 1rem;
    }
}

/* ===== AD CONTAINER FIXES ===== */

.ad-container {
    margin: 1rem auto;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
}

@media (max-width: 767px) {
    .ad-container {
        margin: 0.5rem auto;
    }
}

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

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

/* ===== UTILITY CLASSES ===== */

.text-center {
    text-align: center !important;
}

.text-left {
    text-align: left !important;
}

.text-right {
    text-align: right !important;
}

.d-block {
    display: block !important;
}

.d-inline-block {
    display: inline-block !important;
}

.d-flex {
    display: flex !important;
}

.flex-wrap {
    flex-wrap: wrap !important;
}

.align-items-center {
    align-items: center !important;
}

.justify-content-between {
    justify-content: space-between !important;
}

.justify-content-center {
    justify-content: center !important;
}

/* Spacing utilities */
.m-0 { margin: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }

/* ===== PRINT STYLES ===== */

@media print {
    .sidebar,
    .ad-container,
    button,
    .btn,
    input[type="submit"],
    input[type="button"] {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .site-content {
        grid-template-columns: 1fr;
        grid-template-areas: "main";
    }
}

/* ===== ACCESSIBILITY ===== */

/* Focus styles */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #ff6600;
    outline-offset: 2px;
}

/* Skip to main content link */
.skip-to-main {
    position: absolute;
    left: -9999px;
    z-index: 999;
}

.skip-to-main:focus {
    left: 0;
    top: 0;
    background: #ff6600;
    color: white;
    padding: 1rem;
    text-decoration: none;
}

/* ===== DARK MODE SUPPORT ===== */

@media (prefers-color-scheme: dark) {
    /* Already dark by default, but can add overrides here */
}

/* ===== REDUCED MOTION ===== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
