/* =========================================
   ASHIRAN MASTER THEME (Optimized)
   v2.1 - Dark Luxury Edition
   ========================================= */

/* 1. IMPORTS & SETUP */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600&family=Sarabun:wght@300;400;500&display=swap');

:root {
    --ashi-gold: #C5A059;          /* Main Gold */
    --ashi-gold-hover: #ffe0b2;    /* Lighter Gold for Hover */
    --ashi-gold-dim: rgba(197, 160, 89, 0.15); /* Dimmed Gold */
    --bg-dark: #121212;            /* Main Background */
    --bg-card: #1e1e1e;            /* Card Background */
    --text-main: #ffffff;
    --text-muted: #ebebeb;
    --font-head: 'Kanit', sans-serif;
    --font-body: 'Sarabun', sans-serif;
    
    /* Forex Tool Colors */
    --cur-green: #01A77F;
    --cur-red: #DB2F21;
}

/* 2. GLOBAL RESET */
html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
    background-color: var(--bg-dark) !important;
    color: var(--text-main) !important;
    font-family: var(--font-body) !important;
    font-weight: 400;
    line-height: 1.6;
    margin: 0; padding: 0;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark) !important; }
::-webkit-scrollbar-thumb { 
    background: rgba(197, 160, 89, 0.5); 
    border-radius: 4px; 
    border: 1px solid var(--bg-dark); 
}
::-webkit-scrollbar-thumb:hover { background: var(--ashi-gold) !important; }

/* Links */
a { color: var(--ashi-gold); text-decoration: none; transition: all 0.2s ease; }
a:hover { color: var(--ashi-gold-hover); text-shadow: 0 0 5px rgba(197, 160, 89, 0.4); }
a.whitecon { color: var(--text-main); }
a.whitecon:hover { color: var(--ashi-gold) !important; }

/* 3. TYPOGRAPHY */
h1, h2, h3, h4, h5, h6 { font-family: var(--font-head) !important; color: var(--ashi-gold) !important; }

/* Responsive Headings */
h1 { font-size: 1.65rem; letter-spacing: 1px; }
h2, h3 { font-size: 1.4rem; letter-spacing: 1px; }
h4, h5 { font-size: 1.2rem; }
h6 { font-size: 1rem; }

@media (min-width: 768px) {
    h1 { font-size: 1.75rem; letter-spacing: 1.5px; }
    h2, h3 { font-size: 1.5rem; }
}

/* 4. NAVBAR & MENU */
#mainnav { position: fixed !important; z-index: 9999 !important; }
#sponnav { position: fixed !important; z-index: 9999 !important; }
#ads_footer { position: fixed !important; z-index: 5555 !important; }
.navbar-bgcustom { background-color: var(--bg-dark) !important; border-bottom: 1px solid var(--ashi-gold-dim); }
.navbar-custom .navbar-brand, .navbar-custom .nav-link { color: var(--text-main) !important; }
.navbar-custom .nav-link.active, .navbar-custom .nav-link:hover { color: var(--ashi-gold) !important; }
.nav-link.border-success { border-color: var(--ashi-gold) !important; }

/* Hamburger Animation */
.animated-icon2 { width: 30px; height: 20px; position: relative; cursor: pointer; }
.animated-icon2 span {
    display: block; position: absolute; height: 3px; width: 100%;
    border-radius: 9px; opacity: 1; left: 0; background: var(--ashi-gold) !important;
    transition: .25s ease-in-out;
}
.animated-icon2 span:nth-child(1) { top: 0px; }
.animated-icon2 span:nth-child(2), .animated-icon2 span:nth-child(3) { top: 10px; }
.animated-icon2 span:nth-child(4) { top: 20px; }
.animated-icon2.open span:nth-child(1), .animated-icon2.open span:nth-child(4) { top: 11px; width: 0%; left: 50%; }
.animated-icon2.open span:nth-child(2) { transform: rotate(45deg); }
.animated-icon2.open span:nth-child(3) { transform: rotate(-45deg); }

/* Dropdown */
.dropdown-menu { background-color: #ffffff !important; border: 1px solid var(--ashi-gold-dim) !important; }
.dropdown-item { color: #212529 !important; }
.dropdown-item:hover { background-color: var(--ashi-gold-dim) !important; color: var(--ashi-gold) !important; }
.dropdown-divider { border-top: 1px solid rgba(255,255,255,0.1); }

/* 5. BUTTONS (Consolidated) */
/* Solid Gold Button */
.btn-custom, .btn-primary, .btn-gold-gradient {
    background: linear-gradient(135deg, var(--ashi-gold) 0%, #a88540 100%) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 30px;
    font-weight: 500;
    transition: 0.3s;
}
.btn-custom:hover, .btn-primary:hover, .btn-gold-gradient:hover {
    background: #FFD700 !important;
    color: #000 !important;
    box-shadow: 0 0 10px var(--ashi-gold-dim) !important;
    transform: translateY(-2px);
}

/* Outline Gold Button */
.btn-outline-custom, .btn-dark-outline-gold {
    background: transparent !important;
    color: var(--ashi-gold) !important;
    border: 1px solid var(--ashi-gold) !important;
    border-radius: 30px;
    font-weight: 500;
    transition: 0.3s;
}
.btn-outline-custom:hover, .btn-dark-outline-gold:hover {
    background: rgba(197, 160, 89, 0.1) !important;
    color: #FFD700 !important;
}

/* 6. CARDS & CONTENT */
.blog-card, .form-card, .luxury-ads-card {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--ashi-gold-dim);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    overflow: hidden;
    margin-bottom: 25px;
}

/* Cover Image (Standard 16:9) */
.cover-ratio-16-9 {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover; /* Changed to cover to fill space */
    background-color: #000;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: block;
}

/* Ads Components */
.ads-header-gold {
    background: linear-gradient(90deg, #000 0%, var(--bg-card) 100%);
    color: var(--ashi-gold);
    padding: 15px;
    font-weight: bold;
    font-size: 1.2rem;
    border-bottom: 1px solid rgba(197, 160, 89, 0.2);
}
.ads-detail-box {
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.03);
    border-left: 4px solid var(--ashi-gold);
    margin: 10px;
    font-family: var(--font-body) !important;
}

[name="maincontent"] iframe {
    width: 100% !important;       /* บังคับกว้าง 100% ของ Container */
    max-width: 100% !important;   /* ห้ามเกินขอบ */
    height: auto !important;      /* ปล่อยความสูง auto */
    aspect-ratio: 16 / 9;         /* ล็อคสัดส่วน 16:9 (สำคัญมาก ไม่งั้นวิดีโอจะแบนหรือยืด) */
    
    display: block !important;
    margin: 20px auto !important; /* จัดกึ่งกลางและเว้นระยะบนล่าง */
    
    /* ตกแต่งเพิ่มเติมตามธีม */
    border-radius: 15px;
    border: 1px solid rgba(197, 160, 89, 0.3); /* ขอบทองจางๆ */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

[name="maincontent"] p:has(iframe) {
    width: 100%;
    margin: 0;
    padding: 0;
}

/* 7. FORMS & INPUTS */
.form-control, div[type=text], .textarea, select {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid #444 !important;
    color: var(--text-main) !important;
    border-radius: 8px;
}
.form-control:focus, div[type=text]:focus {
    border-color: var(--ashi-gold) !important;
    background-color: rgba(0, 0, 0, 0.2) !important;
    box-shadow: none;
}
.form-floating label { color: var(--text-muted); }
.form-floating input:focus ~ label, .form-floating input:not(:placeholder-shown) ~ label { color: var(--ashi-gold); }

/* 8. CODE BLOCKS */
.code-container {
    background-color: #1a1a1a !important;
    border: 1px solid var(--ashi-gold-dim);
    border-radius: 6px; margin: 20px 0; overflow: hidden;
    font-family: 'Consolas', monospace; font-size: 16px;
}
ol.code { padding: 10px 0; margin: 0; list-style: none; counter-reset: item; }
ol.code li { position: relative; padding-left: 3.5em; color: #d4d4d4; }
ol.code li::before {
    content: counter(item); position: absolute; left: 0; width: 2.5em;
    text-align: right; color: #666; padding-right: 15px; border-right: 1px solid #333;
}
/* MQL4 Syntax Highlighting */
.mqlType { color: #FFD700; font-weight: bold; }
.mqlCondition { color: #C586C0; }
.mqlFunction { color: #DCDCAA; }
.mqlNumber { color: #B5CEA8; }
.mqlString { color: #CE9178; }
.mqlComment { color: #6A9955; font-style: italic; }

/* 9. UTILITIES */
.alert-danger { background-color: rgba(220, 53, 69, 0.1); border: 1px solid #dc3545; color: #ff6b6b; }
.ui-tooltip {
    padding: 8px 15px;
    background: var(--bg-card) !important;
    color: var(--ashi-gold);
    border: 1px solid var(--ashi-gold);
    border-radius: 8px;
    font-size: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5) !important;
}

/* =========================================
   Luxury Ads Card & Video Fix
   ========================================= */

/* 1. Main Card Structure */
.luxury-ads-card {
    background-color: var(--bg-card, #252525);
    border: 1px solid var(--ashi-gold-dim, rgba(197, 160, 89, 0.3));
    border-radius: 15px;
    overflow: hidden; /* บังคับให้ลูกๆ อยู่ในขอบมน */
    color: var(--text-main, #ffffff);
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

/* 2. Header Style */
.ads-header-gold {
    background: linear-gradient(90deg, #000000 0%, var(--bg-card, #252525) 100%);
    color: var(--ashi-gold, #C5A059);
    padding: 15px 20px;
    font-family: var(--font-head, 'Kanit', sans-serif) !important; /* บังคับใช้ฟอนต์ธีม */
    font-weight: 600;
    font-size: 1.25rem;
    border-bottom: 1px solid var(--ashi-gold-dim, rgba(197, 160, 89, 0.2));
}

/* 3. VIDEO FIX (สำคัญ: ทำให้ YouTube เต็มจอ) */
.ads-media-wrapper.video-container {
    position: relative;
    width: 100%;
    /* เทคนิค Aspect Ratio 16:9 สำหรับ Video Container */
    aspect-ratio: 16 / 9; 
    background-color: #000;
}

.ads-media-wrapper.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: none;
    display: block;
}

/* 4. Content Detail Box */
.ads-detail-box {
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.03);
    border-left: 4px solid var(--ashi-gold, #C5A059);
    margin: 15px;
    border-radius: 0 5px 5px 0;
}

.ads-detail-box p {
    margin-bottom: 10px;
    font-family: var(--font-body, 'Sarabun', sans-serif);
    color: #e0e0e0;
}

.ads-detail-box a {
    color: var(--ashi-gold, #C5A059);
    text-decoration: underline;
    word-break: break-all; /* ป้องกันลิงก์ยาวทะลุกล่อง */
}

/* 5. Action Buttons */
.ads-action-area {
    background-color: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-gold-gradient {
    background: linear-gradient(135deg, var(--ashi-gold, #C5A059) 0%, #a88540 100%);
    color: #fff;
    border: none;
    border-radius: 30px;
    font-weight: 500;
    transition: 0.3s;
}

.btn-gold-gradient:hover {
    background: #FFD700;
    color: #000;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(197, 160, 89, 0.4);
}

.btn-dark-outline-gold {
    background: transparent;
    color: var(--ashi-gold, #C5A059);
    border: 1px solid var(--ashi-gold, #C5A059);
    border-radius: 30px;
    font-weight: 500;
    transition: 0.3s;
}

.btn-dark-outline-gold:hover {
    background: rgba(197, 160, 89, 0.1);
    color: #FFD700;
    border-color: #FFD700;
}