/*
Theme Name: Square Dance Club (Dark Theme)
Description: A custom dark theme for a square dance club with a logo header, drop-down menus, and right sidebar.
Author: Your Club Name
Version: 1.1
*/

:root {
    --denim-blue: #355c99;     /* Slightly lighter denim to stand out on dark backgrounds */
    --bandana-red: #d32f2f;    /* Vibrant red for accents */
    --wood-dark: #1a110e;      /* Very dark rustic brown for the main background */
    --leather-box: #2b1e19;    /* Lighter warm brown for content boxes and sidebar */
    --wheat: #e5c158;          /* Rustic gold for titles and highlights */
    --text-cream: #f4efe9;     /* Soft off-white for highly readable main text */
}

body {
    margin: 0;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--wood-dark);
    color: var(--text-cream);
}

/* Header Layout */
.site-header {
    background-color: var(--leather-box);
    border-bottom: 4px solid var(--bandana-red);
}

.header-top {
    display: flex;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.custom-logo {
    max-height: 120px;
    width: auto;
    margin-right: 20px;
}

.site-title {
    font-size: 2.5rem;
    color: var(--wheat);
    margin: 0;
}

.site-title a {
    color: var(--wheat);
    text-decoration: none;
}

.site-title a:hover {
    color: var(--text-cream);
}

/* Navigation Menu */
.main-navigation {
    background-color: var(--denim-blue);
}

.main-navigation ul {
    list-style: none;
    margin: 0 auto;
    padding: 0;
    max-width: 1200px;
    display: flex;
}

.main-navigation li {
    position: relative;
}

.main-navigation a {
    display: block;
    padding: 15px 20px;
    color: #ffffff;
    text-decoration: none;
    font-weight: bold;
}

.main-navigation a:hover {
    background-color: var(--bandana-red);
}

/* Dropdown Menus */
.main-navigation ul ul.sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--denim-blue);
    flex-direction: column;
    min-width: 200px;
    z-index: 9999;
    border-top: 2px solid var(--wheat);
}

.main-navigation li:hover > ul.sub-menu {
    display: flex;
}

.main-navigation ul ul.sub-menu ul.sub-menu {
    top: 0;
    left: 100%;
}

/* Main Layout */
.site-content {
    display: flex;
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    gap: 40px;
}

.main-area {
    flex: 1;
}

/* Post/Page Content Area Styling */
.main-area article {
    background-color: var(--leather-box);
    padding: 30px;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.main-area h2 {
    color: var(--wheat);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
    margin-top: 0;
}

/* Links inside the main content */
.entry-content a {
    color: var(--wheat);
}

.entry-content a:hover {
    color: var(--bandana-red);
}

/* Sidebar */
.sidebar {
    width: 300px;
    background-color: var(--leather-box);
    padding: 20px;
    border-top: 4px solid var(--denim-blue);
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.sidebar .widget-title {
    color: var(--wheat);
    margin-top: 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
}

/* Footer */
.site-footer {
    background-color: #0d0907; /* Even darker than the main background */
    color: var(--text-cream);
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    border-top: 2px solid var(--denim-blue);
}

/* Fail-safe: Hide the sidebar entirely if it has no actual widgets inside it */
aside.sidebar:empty,
aside.sidebar:not(:has(.widget)) {
    display: none;
    margin: 0;
    padding: 0;
    border: none;
}

/* ==========================================================================
   The Events Calendar - Dark Theme Fixes
   ========================================================================== */

/* 1. Override the plugin's core color variables to match our theme */
:root {
    --tec-color-text-primary: var(--text-cream);
    --tec-color-text-secondary: #cccccc;
    --tec-color-link-primary: var(--wheat);
    --tec-color-link-primary-hover: var(--bandana-red);
    --tec-color-background: var(--wood-dark);
    --tec-color-background-secondary: var(--leather-box);
    --tec-color-border-primary: var(--denim-blue);
    --tec-color-border-secondary: rgba(255, 255, 255, 0.1);
}

/* 2. Force stubborn text elements to use our cream color */
.tribe-events,
#tribe-events-content, 
.tribe-events .tribe-events-calendar-list__event-description,
.tribe-events .tribe-events-calendar-month__day-date {
    color: var(--text-cream) !important;
}

/* 3. Ensure event titles and links use our Wheat accent color */
.tribe-events h3.tribe-events-calendar-list__event-title a,
.tribe-events h3.tribe-events-calendar-month__calendar-event-title a,
.tribe-events-calendar-month__calendar-event-title,
.tribe-events-c-small-cta__link {
    color: var(--wheat) !important;
    text-decoration: none !important;
}

/* 4. Turn links red when hovering */
.tribe-events h3.tribe-events-calendar-list__event-title a:hover,
.tribe-events h3.tribe-events-calendar-month__calendar-event-title a:hover,
.tribe-events-c-small-cta__link:hover {
    color: var(--bandana-red) !important;
}

/* 5. Fix the hover tooltips on the Month View so they are readable */
.tribe-events-calendar-month__calendar-event-tooltip {
    background-color: var(--leather-box) !important;
    border: 2px solid var(--denim-blue) !important;
    color: var(--text-cream) !important;
}

/* ==========================================================================
   Mobile Responsiveness (Screens smaller than 768px)
   ========================================================================== */

@media (max-width: 768px) {
    
    /* 1. Stack and center the header */
    .header-top {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }

    .custom-logo {
        margin: 0 0 15px 0;
        max-height: 100px; /* Slightly smaller logo for phones */
    }

    .site-title {
        font-size: 2rem; /* Scaled down text */
    }

    /* 2. Stack the main content and sidebar */
    .site-content {
        flex-direction: column;
        margin: 20px auto;
        gap: 20px;
    }

    .sidebar {
        width: 100%; /* Take up the full screen width */
        box-sizing: border-box;
    }

    /* 3. Make the menu touch-friendly */
    .main-navigation ul {
        flex-direction: column;
        width: 100%;
    }

    .main-navigation a {
        padding: 15px;
        text-align: center;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* 4. Disable hover logic and show sub-menus permanently on mobile */
    .main-navigation ul ul.sub-menu {
        position: static;
        display: block;
        width: 100%;
        background-color: rgba(0, 0, 0, 0.2); /* Darken sub-menu backgrounds */
        border-top: none;
    }

    /* Indent sub-menus so they are clearly nested */
    .main-navigation ul ul.sub-menu a {
        padding-left: 40px;
        font-size: 0.95em;
    }

    /* Indent third-level menus even further */
    .main-navigation ul ul.sub-menu ul.sub-menu a {
        padding-left: 60px;
        font-size: 0.9em;
    }
}
