/**
 * TVK Mini Knob Plugin Styles
 */

/* Button Styles */
.tvk-mini-knob-button {
    padding: 10px 20px;
    background-color: #0073aa;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s ease;
    display: inline-block;
    margin: 0;
    clear: both;
    position: relative;
    z-index: 1;
}

.tvk-mini-knob-button:hover {
    background-color: #005a87;
}

.tvk-mini-knob-button:focus {
    outline: 2px solid #005a87;
    outline-offset: 2px;
}

/* Mini Knob Button Styling - TV Knob Appearance (Matches Round Knob Screenshot) */
.tvk-mini-knob-header-button .tvk-mini-knob-button {
    width: 70px;
    height: 70px;
    padding: 0;
    border-radius: 50%;
    /* Dark grey metallic knob - matches screenshot */
    background: 
        radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 50%, #2a2a2a 100%);
    border: 4px solid #1a1a1a;
    box-shadow: 
        inset 0 3px 6px rgba(0, 0, 0, 0.6),
        inset 0 -2px 4px rgba(0, 0, 0, 0.4),
        0 4px 12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    color: #ffd700;
    font-size: 28px;
    font-weight: bold;
    text-align: center;
    line-height: 62px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    overflow: visible;
    /* 3D effect for realistic knob appearance */
    transform-style: preserve-3d;
}

/* Knob Outer Ring - Enhanced 3D Effect */
.tvk-mini-knob-header-button .tvk-mini-knob-button::before {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border-radius: 50%;
    /* Outer ring with depth - matches screenshot */
    background: 
        radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.05) 0%, transparent 60%),
        linear-gradient(135deg, #3a3a3a 0%, #1a1a1a 50%, #2a2a2a 100%);
    z-index: -1;
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.6),
        0 2px 8px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(0, 0, 0, 0.3);
    border: 2px solid #1a1a1a;
}

/* Knob Center Indicator - Red Line Like Screenshot */
.tvk-mini-knob-header-button .tvk-mini-knob-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3px;
    height: 20px;
    background: linear-gradient(to bottom, #ff0000 0%, #cc0000 100%);
    border-radius: 2px;
    transform: translate(-50%, -100%) rotate(0deg);
    box-shadow: 
        0 0 6px rgba(255, 0, 0, 0.9),
        0 0 12px rgba(255, 0, 0, 0.5);
    z-index: 1;
    /* Red indicator line pointing up - matches screenshot */
}

/* Ensure button text appears above center indicator */
.tvk-mini-knob-header-button .tvk-mini-knob-button {
    z-index: 2;
}

.tvk-mini-knob-header-button .tvk-mini-knob-button > * {
    position: relative;
    z-index: 3;
}

/* Enhanced text styling to match screenshot */
.tvk-mini-knob-header-button .tvk-mini-knob-button {
    text-shadow: 
        0 1px 2px rgba(0, 0, 0, 0.9),
        0 0 4px rgba(255, 215, 0, 0.3);
    letter-spacing: 0;
    font-family: Arial, sans-serif;
}

/* Knob Hover Effect */
.tvk-mini-knob-header-button .tvk-mini-knob-button:hover {
    background: linear-gradient(135deg, #3a3a3a 0%, #2a2a2a 100%);
    border-color: #ffd700;
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.5),
        0 4px 12px rgba(255, 215, 0, 0.4),
        0 0 0 3px rgba(255, 215, 0, 0.3);
    transform: scale(1.05);
}

/* Knob Active Effect */
.tvk-mini-knob-header-button .tvk-mini-knob-button:active {
    transform: scale(0.95);
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.7),
        0 2px 6px rgba(255, 215, 0, 0.3);
}

/* Header Button Container - Button in Main Menu Area (Right Side) */
/* Button is now placed in #header-links with the main menu */
#header-core {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    gap: 20px !important;
    position: relative !important;
    min-height: 60px !important;
}

/* Keep header-links on the right (main menu area) */
#header-core #header-links {
    float: none !important;
    margin-left: auto !important;
    order: 2 !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
}

/* Logo on the left side */
#header-core #logo {
    flex-shrink: 0 !important;
    margin-top: 0 !important;
    float: none !important;
    display: inline-block !important;
    vertical-align: middle !important;
    order: 1 !important;
    flex-basis: auto !important;
    align-self: center !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
}

/* Button positioned in header-links (right side with main menu) */
#header-links .tvk-mini-knob-header-button,
#header-links-inner .tvk-mini-knob-header-button {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    float: left !important;
    margin-right: 15px !important;
    vertical-align: middle !important;
    order: -1 !important; /* Place button before menu items */
}

/* Ensure logo content (title/description) aligns properly */
#logo .site-title,
#logo .site-description {
    margin: 0 !important;
    line-height: 1.4 !important;
}

.tvk-mini-knob-header-button {
    display: inline-block !important;
    vertical-align: middle !important;
    margin-left: 0 !important;
    margin-right: 15px !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    position: relative !important;
    z-index: 10 !important;
    visibility: visible !important;
    opacity: 1 !important;
    float: left !important;
    flex-shrink: 0 !important;
    align-self: center !important;
    line-height: normal !important;
    flex-basis: auto !important;
}

/* Button in header-links (main menu area) - specific styling */
/* CRITICAL: Ensure button is always visible in header-links */
/* header-links-inner uses display: table, so button needs to work with that */
#header-links .tvk-mini-knob-header-button,
#header-links-inner .tvk-mini-knob-header-button {
    float: left !important;
    margin-right: 15px !important;
    margin-left: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    vertical-align: middle !important;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 10 !important;
    width: auto !important;
    height: auto !important;
    /* Force visibility - override any theme CSS */
    min-width: 70px !important;
    min-height: 70px !important;
}

/* Ensure button works with header-links-inner display: table */
/* Keep table layout but ensure button is visible */
#header-links-inner {
    display: table !important;
}

/* Button should work with table layout - use inline-block, not table-cell */
/* This ensures button appears before menu items */
#header-links-inner .tvk-mini-knob-header-button {
    display: inline-block !important;
    vertical-align: middle !important;
    padding-right: 15px !important;
    float: left !important;
}

/* Ensure button text is visible */
.tvk-mini-knob-header-button .tvk-mini-knob-button {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    letter-spacing: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #header-core {
        flex-wrap: wrap !important;
        gap: 10px !important;
    }
    
    #logo {
        margin-top: 0 !important;
    }
    
    .tvk-mini-knob-header-button {
        margin-left: 10px !important;
        margin-top: 0 !important;
    }
    
    .tvk-mini-knob-header-button .tvk-mini-knob-button {
        width: 60px;
        height: 60px;
        line-height: 52px;
        font-size: 24px;
    }
    
    /* Adjust red indicator line for smaller button */
    .tvk-mini-knob-header-button .tvk-mini-knob-button::after {
        width: 2px;
        height: 16px;
    }
}

/* Button Container Wrapper */
.tvk-mini-knob-button-wrapper {
    display: block;
    width: 100%;
    margin: 10px 0;
    padding: 5px 0;
    clear: both;
    position: relative;
    z-index: 1;
    text-align: center;
    box-sizing: border-box;
}

/* Header Button Wrapper - Override for header placement */
/* Ensure button wrapper works in header-links (main menu area) */
.tvk-mini-knob-header-button .tvk-mini-knob-button-wrapper {
    display: inline-block;
    width: auto;
    margin: 0;
    padding: 0;
    text-align: left;
    flex-shrink: 0;
}

/* Button wrapper in header-links (main menu area) */
#header-links .tvk-mini-knob-header-button .tvk-mini-knob-button-wrapper,
#header-links-inner .tvk-mini-knob-header-button .tvk-mini-knob-button-wrapper {
    display: inline-block !important;
    margin: 0 !important;
    padding: 0 !important;
    vertical-align: middle !important;
    line-height: normal !important;
    width: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Prevent button from appearing in channel-nav (top navigation bar) */
/* CRITICAL: Button should ONLY appear in #header-links (main menu area), NOT in #channel-nav */
#channel-nav .tvk-mini-knob-header-button,
#channel-nav-core .tvk-mini-knob-header-button,
.channel-navigation .tvk-mini-knob-header-button,
.channel-nav-menu .tvk-mini-knob-header-button {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: absolute !important;
    left: -9999px !important;
}

/* Ensure button appears in #header-links (main menu area) on the right */
#header-links .tvk-mini-knob-header-button,
#header-links-inner .tvk-mini-knob-header-button {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    left: auto !important;
    float: left !important;
    margin-right: 15px !important;
    vertical-align: middle !important;
}

/* Hide button if it appears in header-core (old location) */
#header-core > .tvk-mini-knob-header-button {
    display: none !important;
}

/* Ensure button doesn't overlap with other content */
.tvk-mini-knob-button-wrapper::before,
.tvk-mini-knob-button-wrapper::after {
    content: '';
    display: table;
    clear: both;
}

/* Prevent overlap with WordPress content */
.tvk-mini-knob-button-wrapper + * {
    clear: both;
}

/* Better spacing for WordPress content flow - reduced margins */
body .tvk-mini-knob-button-wrapper {
    margin-top: 10px;
    margin-bottom: 10px;
}

/* Responsive button wrapper */
@media (max-width: 768px) {
    .tvk-mini-knob-button-wrapper {
        margin: 8px 0;
        padding: 5px 0;
    }
}

/* Modal Styles */
.tvk-mini-knob-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
}

.tvk-mini-knob-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    cursor: pointer;
}

.tvk-mini-knob-modal-content {
    position: relative;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    width: auto;
    min-width: 191px;
    max-width: 250px;
    height: auto;
    max-height: 90vh;
    overflow: visible;
    z-index: 1000000;
}

.tvk-mini-knob-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.tvk-mini-knob-modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333333;
}

.tvk-mini-knob-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #666666;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.tvk-mini-knob-modal-close:hover {
    color: #000000;
}

.tvk-mini-knob-modal-close:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
    border-radius: 4px;
}

.tvk-mini-knob-modal-body {
    padding: 0;
    text-align: center;
    overflow: visible;
    width: 100%;
    box-sizing: border-box;
    height: auto;
}

/* Mini Knob Container Styles */
.tvk-mini-knob-container {
    margin: 0;
    padding: 0;
    display: inline-block;
    width: 191px;
    max-width: 191px;
    height: auto;
}

.tvk-mini-knob-container > table {
    border-collapse: collapse;
    border-spacing: 0;
    margin: 0;
    padding: 0;
    width: 191px !important;
    max-width: 191px !important;
}

.tvk-mini-knob-container table[width="191"] {
    width: 191px !important;
    max-width: 191px !important;
    border-collapse: collapse;
    border-spacing: 0;
    margin: 0;
    padding: 0;
}

.tvk-mini-knob-container td {
    padding: 0;
    margin: 0;
    line-height: 0;
}

.tvk-mini-knob-container td img {
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
}

.tvk-mini-knob-container a {
    text-decoration: none;
    border: none;
    outline: none;
    display: inline-block;
    margin: 0;
    padding: 0;
}

.tvk-mini-knob-container a:hover,
.tvk-mini-knob-container a:focus {
    outline: none;
}

.tvk-mini-knob-container img {
    border: 0;
    max-width: none;
    height: auto;
    display: block;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .tvk-mini-knob-modal-content {
        max-width: 95%;
        max-height: 95vh;
    }

    .tvk-mini-knob-modal-header {
        padding: 6px 10px;
    }

    .tvk-mini-knob-modal-header h2 {
        font-size: 16px;
    }

    .tvk-mini-knob-modal-body {
        padding: 0;
    }
}

