/* ========================================
   CasinoCredits2Cash - Unified Styles
   ======================================== */

/* CSS Variables / Theme Colors */
:root {
    --bg-primary: #0f1115;
    --bg-secondary: #1a1f26;
    --text-primary: #ffffff;
    --text-secondary: #b3b8c2;
    --brand-gold: #f3c24d;
    --brand-green: #28c76f;
    --border-color: #2a3441;
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #1a1f26;
    --text-secondary: #495057;
    --border-color: #dee2e6;
}

/* ========================================
   Base Styles
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    transition: all 0.3s ease;
    -webkit-text-size-adjust: 100% !important;
}

/* ========================================
   Navigation Bar
   ======================================== */

.top-nav {
    background: var(--bg-secondary);
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-row-main {
    margin-bottom: 0;
}

.nav-row-secondary {
    margin-top: 0;
}

/* Desktop Navigation: Single row layout */
@media (min-width: 769px) {
    .top-nav {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .nav-row {
        display: contents;
    }
    
    .nav-row-main {
        display: contents;
    }
    
    .nav-row-secondary {
        display: contents;
    }
    
    .nav-favicon {
        margin-right: 20px;
    }
    
    .main-nav-links, .secondary-nav-links {
        display: flex;
        gap: 20px;
        align-items: center;
    }
    
    .secondary-nav-links {
        margin-left: auto;
        margin-right: 20px;
    }
}

/* Mobile Navigation: Grid layout */
@media (max-width: 768px) {
    .top-nav {
        display: -webkit-grid;
        display: grid;
        -webkit-grid-template-columns: 32px 1fr 32px;
        grid-template-columns: 32px 1fr 32px;
        -webkit-grid-template-rows: 44px 44px;
        grid-template-rows: 44px 44px;
        -webkit-align-items: center;
        align-items: center;
        -webkit-column-gap: 12px;
        column-gap: 12px;
        padding: 10px 16px;
        padding-top: calc(10px + env(safe-area-inset-top, 0px));
        min-height: calc(88px + env(safe-area-inset-top, 0px));
    }
    
    .nav-favicon-link {
        grid-column: 1;
        grid-row: 1 / span 2;
        align-self: center;
        justify-self: center;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        border-radius: 4px;
        transition: background 0.2s;
    }
    
    .nav-favicon-link:hover {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .nav-favicon {
        width: 32px;
        height: 32px;
    }
    
    .main-nav-links {
        grid-column: 2;
        grid-row: 1;
        display: flex;
        gap: 16px;
        align-items: center;
        justify-content: center;
        min-height: 44px;
    }
    
    .secondary-nav-links {
        grid-column: 2;
        grid-row: 2;
        display: flex;
        gap: 16px;
        align-items: center;
        justify-content: center;
        min-height: 44px;
    }
    
    .theme-toggle {
        grid-column: 3;
        grid-row: 1 / span 2;
        width: 32px;
        height: 32px;
        display: grid;
        place-items: center;
        align-self: center;
        justify-self: center;
        border-radius: 4px;
    }
}

/* Extra Small Mobile */
@media (max-width: 480px) {
    .logo-text {
        display: none;
    }
    
    .logo-icon {
        width: 28px;
        height: 28px;
        margin-right: 0;
    }
    
    .main-nav-links {
        gap: 8px;
    }
    
    .secondary-nav-links {
        gap: 12px;
    }
    
    .nav-link {
        font-size: 0.8rem;
        padding: 4px 8px;
    }
    
    .theme-toggle {
        font-size: 1rem;
        padding: 6px;
    }
}

/* iPhone Safari Optimizations */
@supports (-webkit-touch-callout: none) {
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        position: relative !important;
        height: -webkit-fill-available !important;
    }
    
    body {
        padding-top: env(safe-area-inset-top) !important;
        padding-bottom: calc(24px + env(safe-area-inset-bottom)) !important;
    }
    
    .top-nav {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 1000 !important;
        padding: 8px 12px !important;
        padding-top: calc(8px + env(safe-area-inset-top, 0px)) !important;
        min-height: calc(72px + env(safe-area-inset-top, 0px)) !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
        background: var(--bg-primary) !important;
    }
    
    .nav-link, .main-nav-link, .secondary-nav-link {
        font-size: 0.65rem !important;
        padding: 2px 1px !important;
    }
    
    .theme-toggle {
        font-size: 1rem !important;
        padding: 4px !important;
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        flex-shrink: 0 !important;
    }
    
    body {
        margin-top: calc(72px + env(safe-area-inset-top, 0px)) !important;
    }
    
    .container, .blog-container {
        max-width: 100vw !important;
        padding-left: 20px !important;
        padding-right: 20px !important;
        padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px)) !important;
        box-sizing: border-box !important;
        margin: 0 auto !important;
        min-height: auto !important;
    }
}

/* Navigation Links */
.main-nav-links, .secondary-nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.main-nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px 4px;
}

.main-nav-link:hover {
    color: var(--text-primary);
}

.main-nav-link.active {
    color: var(--brand-gold) !important;
    font-weight: 600;
}

.secondary-nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
    padding: 8px 4px;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.secondary-nav-link:hover {
    color: var(--text-primary);
}

.secondary-nav-link.active {
    color: var(--brand-gold) !important;
    font-weight: 600;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
    padding: 8px 6px;
    border-radius: 6px;
    min-height: 44px;
    text-align: center;
    white-space: nowrap;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-weight: 500;
}

.nav-link:hover {
    color: var(--text-primary);
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.theme-toggle:hover {
    background: var(--bg-primary);
}

/* Logo Styles */
.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-icon {
    width: 32px;
    height: 32px;
    margin-right: 8px;
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 700;
}

.casino-text {
    color: var(--brand-gold);
}

.cash-text {
    color: var(--brand-green);
}

/* ========================================
   Layout Containers
   ======================================== */

.container {
    max-width: 400px;
    margin: 0 auto;
    padding: 30px 20px;
}

.blog-wrapper {
    max-width: 1250px;
    margin: 0 auto;
    padding: 40px 20px;
    display: flex;
    gap: 25px;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

.blog-container {
    flex: 1;
    max-width: 700px;
    min-height: 100vh;
}

/* Left Sidebar - Author & Navigation */
.blog-sidebar-left {
    width: 250px;
    flex-shrink: 0;
    align-self: flex-start;
}

/* Right Sidebar - Ads & Related */
.blog-sidebar-right {
    width: 250px;
    flex-shrink: 0;
    align-self: flex-start;
    position: sticky;
    top: 100px;
}

.sidebar-sticky {
    position: relative;
    /* Left sidebar scrolls naturally */
}

.sidebar-sticky-right {
    position: relative;
    /* Sticky is now on parent */
}

/* Author Card - UPDATED */
.author-card {
    background: var(--bg-secondary);
    border: 2px solid var(--brand-gold);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    text-align: center;
}

.author-avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--brand-gold), var(--brand-green));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 15px;
    color: #000;
    font-weight: 700;
}

.author-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--brand-gold);
    margin-bottom: 5px;
}

.author-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.author-bio {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    text-align: left;
}

/* Table of Contents - UPDATED */
.toc-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.toc-section h3 {
    font-size: 1rem;
    color: var(--brand-green);
    margin-bottom: 15px;
}

.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.toc-list li {
    margin-bottom: 10px;
}

.toc-list a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
    display: block;
    padding: 4px 0;
}

.toc-list a:hover {
    color: var(--brand-gold);
}

/* Hide sidebars on mobile/tablet */
@media (max-width: 1200px) {
    .blog-sidebar-left,
    .blog-sidebar-right {
        display: none;
    }
    .blog-wrapper {
        justify-content: center;
    }
}

/* ========================================
   Typography
   ======================================== */

h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: var(--brand-gold);
}

h2 {
    font-size: 1.5rem;
    margin: 30px 0 15px 0;
    color: var(--brand-green);
}

h3 {
    font-size: 1.2rem;
    margin: 25px 0 10px 0;
    color: var(--brand-gold);
}

p {
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.lead {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 500;
}

ul, ol {
    margin: 20px 0 20px 20px;
    color: var(--text-secondary);
}

li {
    margin-bottom: 8px;
}

strong {
    color: var(--text-primary);
    font-weight: 600;
}

@media (max-width: 480px) {
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.3rem; }
    h3 { font-size: 1.1rem; }
}

/* ========================================
   Common Components
   ======================================== */

/* Back Link */
.back-link {
    color: var(--brand-gold);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 20px;
    display: inline-block;
}

.back-link:hover {
    color: var(--brand-green);
}

/* Article Header */
.article-header {
    margin-bottom: 40px;
}

.article-meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

/* Header Section */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.subtitle {
    color: var(--brand-green);
    font-size: 1rem;
    margin-bottom: 8px;
}

.main-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.description {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Section Title */
.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--brand-green);
    margin-bottom: 16px;
    text-align: center;
}

/* CTA Box */
.cta-box {
    background: linear-gradient(135deg, rgba(243, 194, 77, 0.1), rgba(40, 199, 111, 0.1));
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    margin: 30px 0;
    border: 2px solid var(--brand-gold);
}

.cta-box h3 {
    color: var(--brand-gold);
    margin-bottom: 10px;
}

.cta-link {
    color: var(--brand-green);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
}

.cta-link:hover {
    color: var(--brand-gold);
}

/* Tip Box */
.tip-box {
    background: var(--bg-secondary);
    padding: 15px 20px;
    border-radius: 8px;
    border-left: 3px solid var(--brand-green);
    margin: 15px 0;
}

.tip-box strong {
    color: var(--brand-green);
}

/* Highlight Box */
.highlight {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid var(--brand-gold);
    margin: 25px 0;
}

/* Related Articles */
.related-articles {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: 12px;
    margin: 40px 0;
}

.related-articles h3 {
    color: var(--brand-gold);
    margin-bottom: 15px;
}

.related-articles ul {
    margin-left: 0;
    list-style: none;
}

.related-articles a {
    color: var(--brand-green);
    text-decoration: none;
    font-weight: 500;
}

.related-articles a:hover {
    color: var(--brand-gold);
}

/* Sidebar Section */
.sidebar-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.sidebar-section h3 {
    color: var(--brand-gold);
    font-size: 1rem;
    margin-bottom: 15px;
}

.sidebar-section ul {
    list-style: none;
    margin: 0;
}

.sidebar-section li {
    margin-bottom: 10px;
}

.sidebar-section a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.sidebar-section a:hover {
    color: var(--brand-green);
}

/* ========================================
   Calculator Specific Styles
   ======================================== */

/* Denomination Chips */
.chips-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 25px;
}

.chip {
    padding: 12px 8px;
    background: var(--brand-gold);
    border: 2px solid var(--brand-gold);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    color: #000;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.chip:hover {
    transform: translateY(-2px);
    border-color: var(--brand-gold);
}

.chip.active {
    background: var(--brand-green);
    border-color: var(--brand-green);
    color: white;
}

/* Custom Denomination */
.custom-denom-section {
    display: none;
    margin-bottom: 20px;
}

.custom-denom-input {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    text-align: center;
}

.custom-denom-input:focus {
    outline: none;
    border-color: var(--brand-gold);
}

/* Credits Input */
.credits-label {
    font-weight: 600;
    color: var(--brand-gold);
    margin-bottom: 8px;
}

.credits-input {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    text-align: center;
    outline: none;
    transition: all 0.2s;
    margin-bottom: 24px;
    -moz-appearance: textfield;
}

.credits-input::-webkit-outer-spin-button,
.credits-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.credits-input:focus {
    border-color: var(--brand-gold);
}

/* Error Message */
.error-message {
    color: #ff4757;
    font-size: 0.9rem;
    margin-bottom: 20px;
    text-align: center;
    display: none;
}

.error-message.show {
    display: block;
}

/* Calculate Button */
.calculate-btn {
    width: 100%;
    padding: 16px;
    background: var(--brand-gold);
    color: #000;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 25px;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(243, 194, 77, 0.3);
}

.calculate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Result Display */
.result-section {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    margin-bottom: 25px;
}

.result-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.result-amount {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--brand-green);
    margin-bottom: 8px;
}

.celebration-message {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 12px;
    padding: 12px;
    border-radius: 8px;
    display: none;
}

.celebration-message.show {
    display: block;
    animation: celebrationPulse 0.6s ease-out;
}

.you-won {
    background: linear-gradient(135deg, var(--brand-gold), #e67e22);
    color: #000;
}

.big-win {
    background: linear-gradient(135deg, var(--brand-green), #22a55b);
    color: white;
}

.jackpot {
    background: linear-gradient(135deg, var(--brand-gold), var(--brand-green));
    color: #000;
}

/* Tips Section */
.tips-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
    display: none;
}

.tips-section.show {
    display: block;
}

.tips-header {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.tip-links {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.tip-link {
    padding: 12px 8px;
    background: var(--brand-gold);
    border: 2px solid var(--brand-gold);
    color: #000;
    text-decoration: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
}

.tip-link:hover {
    transform: translateY(-2px);
    border-color: var(--brand-gold);
    text-decoration: none;
    color: #000;
}

/* Reset Button */
.reset-btn {
    width: 100%;
    padding: 12px;
    background: var(--brand-gold);
    color: #000;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    margin-bottom: 20px;
}

.reset-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(243, 194, 77, 0.3);
}

/* ========================================
   Footer
   ======================================== */

.footer {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

@media (max-width: 480px) {
    .footer {
        font-size: 0.8rem;
        padding: 30px 15px;
    }
}

/* ========================================
   Animations
   ======================================== */

@keyframes celebrationPulse {
    0% {
        transform: scale(1);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========================================
   Responsive Adjustments
   ======================================== */

@media (max-width: 480px) {
    .chips-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
    }

    .chip {
        padding: 10px 6px;
        font-size: 0.95rem;
    }

    .tip-links {
        gap: 6px;
    }

    .tip-link {
        padding: 10px 6px;
        font-size: 0.95rem;
    }
}
