/**
 * Cologna Spacing Fix
 * Fixes excessive margins, empty spacing issues, and background
 */

/* Fix background - use Cologna cream background instead of transparent */
html, body {
    background-color: #FFFCDF !important;
    background: #FFFCDF !important;
    min-height: 100vh;
}

/* Fix all visible elements that might show dark background */
div, span, p, table, td, th, tr, section, article, main, aside, nav, header, footer {
    background-color: inherit;
}

/* Force background on potentially transparent elements */
*:not(head):not(meta):not(title):not(link):not(script):not(style) {
    background-color: inherit;
}

/* Specific fixes for visible transparent elements */
div:empty, span:empty {
    background-color: #FFFCDF !important;
}

/* Fix any elements with inline transparent styles */
*[style*="rgba(0, 0, 0, 0)"] {
    background-color: #FFFCDF !important;
}

/* Ensure no elements have transparent backgrounds */
div, span, p, td, th, tr, table {
    background-color: inherit;
}

/* Fix head and meta elements that somehow get transparent backgrounds */
head, meta, title, link, script, style {
    background: none !important;
}

/* Fix excessive bottom margins on main tables */
table.colognabody {
    margin-bottom: 15px !important; /* Instead of 316px */
    width: 100% !important;
    background-color: #FFFCDF !important;
    min-height: 100vh !important;
}

/* Ensure full layout coverage */
body, html {
    width: 100% !important;
    height: 100% !important;
}

/* Fix general table margins */
table {
    margin-bottom: 10px !important; /* Instead of 297px */
}

/* Fix menu table margins */
table.mainPage-Header-Menu {
    margin-bottom: 5px !important; /* Instead of 297px */
}

/* Remove excessive center div margins */
#center {
    margin: 15px auto !important; /* Instead of 30px */
}

/* Fix empty div spacing */
div:empty {
    display: none;
}

/* Reduce multiple break spacing */
br + br {
    display: none;
}

/* Better spacing for main page elements */
.mainPage-Header-Menu {
    margin-bottom: 10px !important;
}

/* Compact sidebox spacing */
table.sidebox {
    margin-bottom: 10px !important;
    margin-top: 5px !important;
}

/* Fix sidebar container spacing - use actual selectors from the page */
td[width="15%"] {
    padding: 10px 8px !important;
    vertical-align: top !important;
    background-color: #FFF5BF !important;
    background: #FFF5BF !important;
    width: 18% !important; /* Increase from 15% to fill space */
}

/* Fix main content area */
td[width="60%"] {
    padding: 15px !important;
    vertical-align: top !important;
    background-color: #FFF5BF !important;
    background: #FFF5BF !important;
    width: 64% !important; /* Increase from 60% to fill space */
}

/* Ensure table takes full width */
table[width="99%"] {
    width: 100% !important;
    background-color: #FFFCDF !important;
}

/* Sidebar table improvements */
table.sidebox {
    background-color: #FFF5BF !important;
    background: #FFF5BF !important;
}

table.sidebox td {
    padding: 5px 8px !important;
    background-color: inherit !important;
}

table.sidebox tr {
    background-color: inherit !important;
}

/* Remove excessive spacing in sidebar headers */
table.sidebox tr:first-child td {
    padding-top: 8px !important;
    padding-bottom: 5px !important;
}

/* Fix login area spacing */
table[bgcolor="#FFFCDF"] {
    margin-bottom: 10px !important;
}

/* Remove excessive whitespace in table cells */
td:empty,
th:empty {
    height: 1px;
    padding: 0;
    background-color: inherit !important;
}

/* Ensure all table cells have proper background and readable text */
td, th {
    background-color: inherit;
    font-size: 13px !important;
    line-height: 1.4 !important;
    color: #000066 !important; /* Cologna dark blue for better contrast */
}

/* Improve text readability across all elements */
p, span, div, a {
    font-size: 13px !important;
    line-height: 1.4 !important;
    color: #000066 !important;
}

/* Ensure links are visible and readable */
a {
    color: #000066 !important;
    text-decoration: underline !important;
}

a:hover {
    color: #000099 !important;
    background-color: #FFE655 !important;
}

/* Fix any remaining small text */
* {
    font-size: inherit;
    min-font-size: 12px;
}

/* Specific fixes for very small text */
font[size="1"], 
font[size="2"],
.small-text,
[style*="font-size: 8px"],
[style*="font-size: 9px"],
[style*="font-size: 10px"],
[style*="font-size: 11px"] {
    font-size: 13px !important;
}

/* Fix any remaining transparent backgrounds */
td[bgcolor="#FFFFD9"],
td[bgcolor="#FFF5BF"],
td[bgcolor="#FFE655"] {
    background-color: attr(bgcolor) !important;
}

/* Make sure no gaps appear between elements */
table {
    border-collapse: collapse !important;
    background-color: inherit !important;
}

/* Fix useless iframe scrollbars */
iframe {
    scrolling: no !important;
    overflow: hidden !important;
}

/* Hide scrollbars on iframes in top-right area */
iframe[width="970"], 
iframe[width="300"],
iframe[style*="width: 970px"],
iframe[style*="width: 300px"] {
    scrolling: no !important;
    overflow: hidden !important;
    border: none !important;
}

/* Ensure iframes fit properly without scrollbars */
iframe {
    display: block;
    border: none;
}

/* Force all major layout elements to have proper backgrounds */
div, table, td, tr {
    background-color: inherit !important;
}

/* Specific override for any remaining transparent elements */
*[style*="background-color: rgba(0, 0, 0, 0)"] {
    background-color: #FFF5BF !important;
}

*[style*="background: rgba(0, 0, 0, 0)"] {
    background-color: #FFF5BF !important;
}

/* Logo optimization */
img[src*="header"], img[src*="logo"], img[alt*="Cologna"] {
    max-width: 300px !important;
    min-width: 200px !important;
    height: auto !important;
    display: block !important;
}

/* Better responsive spacing */
@media (max-width: 768px) {
    table.colognabody {
        margin-bottom: 10px !important;
    }
    
    #center {
        margin: 10px auto !important;
    }
    
    table {
        margin-bottom: 8px !important;
    }
    
    /* Touch-friendly buttons on mobile */
    input[type="submit"], 
    input[value="Spielen"],
    button {
        min-height: 44px !important;
        padding: 12px 20px !important;
        font-size: 16px !important;
        touch-action: manipulation;
    }
}

@media (max-width: 480px) {
    table.colognabody {
        margin-bottom: 5px !important;
    }
    
    #center {
        margin: 5px auto !important;
    }
    
    table {
        margin-bottom: 5px !important;
    }
    
    /* Enhanced touch targets on small mobile */
    input[type="submit"], 
    input[value="Spielen"],
    button {
        min-height: 48px !important;
        padding: 15px 25px !important;
        font-size: 18px !important;
        width: auto !important;
        min-width: 120px !important;
    }
    
    /* Better form field spacing on mobile */
    input[type="text"],
    input[type="password"] {
        min-height: 44px !important;
        padding: 12px 15px !important;
        font-size: 16px !important;
        margin-bottom: 10px !important;
    }
}