/*
Theme Name: D-Dealer Block Theme
Theme URI: https://example.com/d-dealer
Author: SGMR factory
Author URI: https://example.com
Description: D-Dealer Official Block Theme.
Version: 0.2.9.0
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 8.0
*/

/* --- Base Variables & Reset --- */
:root {
    --bg-body: #f8fafc;
    --text-main: #334155;
    --text-sub: #64748b;
    --text-head: #0f172a;
    --link-color: #0ea5e9;
    
    --header-bg: rgba(255, 255, 255, 0.85);
    --header-text: #0f172a;
    --nav-link: #334155;
    --nav-link-hover: #0ea5e9;
    
    --news-bg: #1e293b;
    --news-text: #ffffff;
    --news-border: rgba(255, 255, 255, 0.1);
    
    --card-bg: #ffffff;
    --card-border: transparent;
    --card-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05), 0 2px 6px -2px rgba(0, 0, 0, 0.05);
    
    --card-hover-border: transparent;
    --card-hover-bg: #ffffff;
    --card-hover-shadow: 0 20px 30px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -5px rgba(0, 0, 0, 0.05);

    --footer-bg: #1e293b;
    --footer-text: #ffffff;
    --footer-border: #334155;
    
    --icon-bg-def: #f0f9ff;
    --icon-color-def: #0ea5e9;

    /* Material 3 Expressive Additions */
    --m3-radius-m: 12px;
    --m3-radius-l: 16px;
    --m3-radius-xl: 24px;
    --m3-surface-gap: 24px;
}

/* --- Dark Mode Dynamic Override --- */
:root[data-theme="dark"],
body[data-theme="dark"],
body.is-dark {
    --wp--preset--color--base: #0a192f !important;
    --wp--preset--color--main: #8892b0 !important;
    --wp--preset--color--sub: #a8b2d1 !important;
    --wp--preset--color--head: #e6f1ff !important;
    --wp--preset--color--accent: #64ffda !important;
    --wp--preset--color--header-bg: #112240 !important;
    --wp--preset--color--card-bg: #112240 !important;
    --wp--preset--color--card-border: rgba(255, 255, 255, 0.1) !important;
    --wp--preset--color--news-bg: #112240 !important;
    --wp--preset--color--white: #ffffff !important;
    
    --bg-body: #0a192f;
    --text-main: #8892b0;
    --text-sub: #a8b2d1;
    --text-head: #e6f1ff;
    --link-color: #64ffda;
    --header-bg: rgba(10, 25, 47, 0.85);
    --card-bg: #112240;
    --card-border: rgba(255, 255, 255, 0.1);
    --footer-bg: #020c1b;
    --footer-text: #8892b0;
    --icon-bg-def: rgba(14, 165, 233, 0.1);
    --icon-color-def: #0ea5e9;
}

/* --- Base & Reset --- */
body {
    background-color: var(--wp--preset--color--base) !important;
    background-image: radial-gradient(rgba(224,242,254,0.3) 1px, transparent 1px);
    background-size: 24px 24px;
    background-attachment: fixed;
    color: var(--wp--preset--color--main) !important;
    transition: background-color 0.3s, color 0.3s;
    display: flex; flex-direction: column; min-height: 100vh;
}
body.is-dark { background-image: none; }

a { text-decoration: none; transition: color 0.2s; color: inherit; }
img { max-width: 100%; height: auto; }

.d-main-content { flex: 1; width: 100%; margin-top: 140px; padding-bottom: 60px; }
.d-container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; box-sizing: border-box; }

/* --- Content Surface --- */
.d-content-surface {
    background-color: var(--wp--preset--color--card-bg);
    border-radius: var(--m3-radius-xl);
    padding: 48px;
    box-shadow: var(--card-shadow);
    max-width: 960px; margin: 0 auto;
    color: var(--wp--preset--color--main);
}

/* --- Hero Header --- */
.d-hero-header { margin-bottom: 40px; text-align: center; }
.d-hero-header .wp-block-post-title { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; color: var(--wp--preset--color--head); }
.d-hero-header .wp-block-post-featured-image img { width: 100%; height: auto; max-height: 480px; object-fit: cover; border-radius: var(--m3-radius-xl); box-shadow: var(--card-shadow); }

/* --- Header --- */
.d-header {
    background-color: var(--wp--preset--color--header-bg) !important;
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    position: fixed !important; top: 0; left: 0; width: 100%; z-index: 9999;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
body.admin-bar .d-header { top: 32px; }
@media (max-width: 782px) { body.admin-bar .d-header { top: 46px; } }

.d-header-top { height: 90px; border-bottom: none; }
.d-header-logo-text p { color: var(--wp--preset--color--sub) !important; font-size: 13px; margin: 0; }
.d-header-bottom { height: auto; min-height: 48px; border-bottom: 1px solid rgba(0,0,0,0.05); }
body.is-dark .d-header-bottom { border-bottom-color: rgba(255,255,255,0.05); }

/* Navigation */
.d-header-nav .wp-block-navigation-item__content {
    color: var(--wp--preset--color--main) !important; font-weight: 600; font-size: 14px;
    padding: 8px 16px; border-radius: 999px;
}
.d-header-nav .wp-block-navigation-item__content:hover {
    color: var(--wp--preset--color--accent) !important; background-color: var(--icon-bg-def); text-decoration: none;
}

/* --- Dark Mode Toggle (Button Style) --- */
.d-dark-mode-toggle {
    background: transparent !important; border: none !important; padding: 0 !important; margin: 0 !important;
    cursor: pointer !important; outline: none; display: inline-block; vertical-align: middle; line-height: 0; z-index: 10000;
}
.d-toggle-track {
    display: flex; align-items: center; justify-content: space-between;
    width: 52px; height: 28px; background-color: rgba(0, 0, 0, 0.08);
    border-radius: 34px; position: relative; padding: 0 4px; box-sizing: border-box;
    transition: background-color 0.4s; pointer-events: none;
}
body.is-dark .d-toggle-track { background-color: rgba(255, 255, 255, 0.15); }
.d-toggle-handle {
    position: absolute; height: 20px; width: 20px; left: 4px; bottom: 4px;
    background-color: white; border-radius: 50%; transition: transform 0.4s; z-index: 2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
body.is-dark .d-toggle-handle { transform: translateX(24px); }
.d-dark-mode-toggle i { font-size: 14px; z-index: 1; line-height: 1; display: flex; color: #64748b; }
.d-dark-mode-toggle i.icon-moon { color: #fbbf24; }

/* --- News Bar (Striped) --- */
.d-news-bar { 
    background-color: var(--wp--preset--color--card-bg); 
    border-radius: var(--m3-radius-l); padding: 24px; margin-bottom: 60px;
    box-shadow: var(--card-shadow);
}
.d-news-item { 
    display: flex; align-items: center; gap: 16px; 
    border-bottom: none; padding: 12px 24px; border-radius: 8px;
}
.d-news-item:nth-child(odd) { background-color: rgba(0,0,0,0.02); }
body.is-dark .d-news-item:nth-child(odd) { background-color: rgba(255,255,255,0.03); }
.d-news-text a { color: var(--wp--preset--color--main) !important; text-decoration: none; font-weight: 500; }
.d-news-text a:hover { color: var(--link-color) !important; }

/* News Badge (Paragraph Style - Block Friendly) */
p.d-news-badge {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: #f59e0b;
    color: white !important;
    font-size: 14px;
    font-weight: bold;
    border-radius: 10px;
    margin: 0 !important; /* Force reset WP margins */
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

/* --- Footer --- */
.d-footer { 
    background: var(--footer-bg); color: white; padding: 60px 0 40px; margin-top: auto;
    border-top-left-radius: var(--m3-radius-xl); border-top-right-radius: var(--m3-radius-xl);
}
.d-footer-links a { color: #94a3b8; font-size: 15px; font-weight: 500; }
.d-footer-links a:hover { color: white; }

/* --- Tools Anchor Offset --- */
#tools {
    scroll-margin-top: 140px;
}

/* Editor Fixes */
.editor-styles-wrapper .d-header { position: absolute !important; }
.editor-styles-wrapper .d-main-content { margin-top: 140px; }