/* ============================================
   Custom CSS for Modern IT Blog
   Theme: Cyan-Dark (Xanh Đen)
   Light & Dark Mode Support
   ============================================ */

/* Import fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ============================================
   LIGHT MODE (Default)
   ============================================ */
:root {
    /* Cyan-Dark Color Palette */
    --primary-cyan: #00d9ff;
    --primary-blue: #0ea5e9;
    --dark-bg: #0f172a;
    --darker-bg: #020617;
    --accent-cyan: #22d3ee;
    --accent-teal: #14b8a6;
    --accent-purple: #8b5cf6;
    
    /* Light mode colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-hover: #e2e8f0;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-cyan: 0 8px 24px rgba(0, 217, 255, 0.25);
    --shadow-blue: 0 8px 24px rgba(14, 165, 233, 0.25);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #00d9ff 0%, #0ea5e9 100%);
    --gradient-secondary: linear-gradient(135deg, #22d3ee 0%, #14b8a6 100%);
    --gradient-dark: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --gradient-purple: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    
    /* Border radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ============================================
   DARK MODE
   ============================================ */
.dark {
    /* Dark mode colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-hover: #475569;
    
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    
    --border-color: #334155;
    --border-hover: #475569;
    
    /* Enhanced cyan glow in dark mode */
    --shadow-cyan: 0 8px 32px rgba(0, 217, 255, 0.4);
    --shadow-blue: 0 8px 32px rgba(14, 165, 233, 0.4);
}

/* ============================================
   GLOBAL STYLES
   ============================================ */
* {
    transition: background-color var(--transition-base), 
                color var(--transition-base),
                border-color var(--transition-base);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* ============================================
   PROFILE MODE (Homepage)
   ============================================ */
.profile {
    position: relative;
}

.profile img,
.profile-mode .profile-image {
    border: 4px solid transparent;
    background: var(--gradient-primary);
    padding: 4px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-cyan);
    transition: all var(--transition-base);
    animation: float 3s ease-in-out infinite;
}

.profile img:hover,
.profile-mode .profile-image:hover {
    transform: scale(1.08) rotate(5deg);
    box-shadow: 0 12px 40px rgba(0, 217, 255, 0.5);
}

/* Floating animation */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* Profile title with gradient */
.profile .profile_inner h1,
.profile-mode h1 {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    letter-spacing: -0.02em;
}

/* Profile subtitle */
.profile .profile_inner .subtitle,
.profile-mode .subtitle {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================
   BUTTONS & LINKS
   ============================================ */
.button,
.btn,
button,
.profile-mode .button,
a.button {
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 12px 28px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-blue);
    position: relative;
    overflow: hidden;
}

.button::before,
.btn::before,
button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.button:hover::before,
.btn:hover::before,
button:hover::before {
    left: 100%;
}

.button:hover,
.btn:hover,
button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(14, 165, 233, 0.4);
}

.button:active,
.btn:active,
button:active {
    transform: translateY(-1px);
}

/* ============================================
   POST CARDS
   ============================================ */
.post-entry {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-cyan);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.post-entry::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-base);
    z-index: -1;
}

.post-entry:hover {
    transform: translateY(-6px) scale(1.01);
    border-left-color: var(--accent-teal);
    box-shadow: var(--shadow-xl), var(--shadow-cyan);
}

.post-entry:hover::before {
    opacity: 0.03;
}

/* Post title */
.post-title {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.25rem;
    transition: color var(--transition-base);
}

.post-entry:hover .post-title {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Post meta */
.post-meta {
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

/* Post summary */
.post-summary {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ============================================
   TAGS
   ============================================ */
.post-tags,
.terms-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.post-tags a,
.terms-tags a {
    background: var(--gradient-secondary);
    color: white;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.post-tags a:hover,
.terms-tags a:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 6px 20px rgba(20, 184, 166, 0.4);
    background: var(--gradient-purple);
}

/* ============================================
   CODE BLOCKS
   ============================================ */
code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    background: var(--bg-tertiary);
    color: var(--primary-cyan);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.9em;
    font-weight: 500;
}

.dark code {
    background: var(--bg-secondary);
}

pre {
    background: var(--darker-bg);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-cyan);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    overflow-x: auto;
    box-shadow: var(--shadow-md);
}

pre code {
    background: transparent;
    color: #f1f5f9;
    padding: 0;
}

.highlight {
    border-radius: var(--radius-md);
    overflow: hidden;
    margin: 1.5rem 0;
    box-shadow: var(--shadow-lg);
}

/* ============================================
   SOCIAL ICONS
   ============================================ */
.social-icons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.social-icons a {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--primary-cyan);
    transition: all var(--transition-base);
}

.social-icons a:hover {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
    transform: translateY(-4px) rotate(5deg);
    box-shadow: var(--shadow-cyan);
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */
.nav {
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.dark .nav {
    background: rgba(15, 23, 42, 0.8);
}

.menu a {
    color: var(--text-secondary);
    font-weight: 600;
    transition: all var(--transition-fast);
    position: relative;
}

.menu a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: all var(--transition-base);
    transform: translateX(-50%);
}

.menu a:hover {
    color: var(--primary-cyan);
}

.menu a:hover::after,
.menu a.active::after {
    width: 100%;
}

/* Theme toggle */
.theme-toggle {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px;
    transition: all var(--transition-base);
}

.theme-toggle:hover {
    background: var(--gradient-primary);
    border-color: transparent;
    transform: rotate(180deg);
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    background: var(--gradient-dark);
    color: var(--text-secondary);
    padding: 3rem 0 2rem;
    margin-top: 4rem;
    border-top: 1px solid var(--primary-cyan);
}

.dark footer {
    background: var(--darker-bg);
}

footer a {
    color: var(--primary-cyan);
    transition: color var(--transition-base);
}

footer a:hover {
    color: var(--accent-cyan);
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gradient-secondary);
}

/* ============================================
   READING PROGRESS BAR
   ============================================ */
#progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    background: var(--gradient-primary);
    z-index: 9999;
    transition: width 0.1s ease;
    box-shadow: 0 0 10px var(--primary-cyan);
}

/* ============================================
   SEARCH
   ============================================ */
#searchInput {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px 20px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-base);
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary-cyan);
    box-shadow: 0 0 0 4px rgba(0, 217, 255, 0.1), var(--shadow-cyan);
}

/* ============================================
   TABLE OF CONTENTS
   ============================================ */
.toc {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-cyan);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.toc a {
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    display: block;
    padding: 0.5rem 0;
    border-left: 2px solid transparent;
    padding-left: 1rem;
    margin-left: -1rem;
}

.toc a:hover {
    color: var(--primary-cyan);
    border-left-color: var(--primary-cyan);
    background: var(--bg-hover);
}

/* ============================================
   BLOCKQUOTE
   ============================================ */
blockquote {
    background: var(--bg-secondary);
    border-left: 4px solid var(--primary-cyan);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    padding: 1.5rem 2rem;
    margin: 2rem 0;
    font-style: italic;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
    position: relative;
}

blockquote::before {
    content: '"';
    font-size: 4rem;
    color: var(--primary-cyan);
    opacity: 0.2;
    position: absolute;
    top: -10px;
    left: 10px;
    font-family: Georgia, serif;
}

/* ============================================
   BREADCRUMBS
   ============================================ */
.breadcrumbs {
    display: flex;
    gap: 0.5rem;
    color: var(--text-tertiary);
}

.breadcrumbs a {
    color: var(--primary-cyan);
    transition: color var(--transition-fast);
}

.breadcrumbs a:hover {
    color: var(--accent-cyan);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.post-entry {
    animation: fadeInUp 0.6s ease-out backwards;
}

.post-entry:nth-child(1) { animation-delay: 0.1s; }
.post-entry:nth-child(2) { animation-delay: 0.2s; }
.post-entry:nth-child(3) { animation-delay: 0.3s; }
.post-entry:nth-child(4) { animation-delay: 0.4s; }
.post-entry:nth-child(5) { animation-delay: 0.5s; }

/* ============================================
   UTILITY CLASSES
   ============================================ */
.glow {
    box-shadow: var(--shadow-cyan);
}

.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .post-entry {
        margin: 1rem 0;
    }
    
    .profile img,
    .profile-mode .profile-image {
        width: 120px;
        height: 120px;
    }
    
    .button,
    .btn,
    button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   LOADING STATES
   ============================================ */
.loading {
    animation: pulse 2s ease-in-out infinite;
}

/* ============================================
   CONTENT TYPOGRAPHY (Reduced font sizes)
   ============================================ */

/* Main content area */
.post-content,
.page-content,
article .content {
    font-size: 15px;
    line-height: 1.7;
}

/* Headings - Smaller sizes */
.post-content h1,
.page-content h1 {
    font-size: 1.75rem; /* 28px instead of default larger */
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.post-content h2,
.page-content h2 {
    font-size: 1.4rem; /* 22.4px instead of default larger */
    margin-top: 1.75rem;
    margin-bottom: 0.875rem;
    font-weight: 700;
}

.post-content h3,
.page-content h3 {
    font-size: 1.15rem; /* 18.4px */
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.post-content h4,
.page-content h4 {
    font-size: 1.05rem; /* 16.8px */
    margin-top: 1.25rem;
    margin-bottom: 0.625rem;
    font-weight: 600;
}

/* Paragraphs */
.post-content p,
.page-content p {
    font-size: 15px;
    line-height: 1.7;
    margin-bottom: 1rem;
}

/* Lists - Smaller spacing */
.post-content ul,
.post-content ol,
.page-content ul,
.page-content ol {
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.post-content li,
.page-content li {
    margin-bottom: 0.4rem;
}

/* Blockquotes */
.post-content blockquote,
.page-content blockquote {
    font-size: 14px;
    line-height: 1.6;
}

/* Tables */
.post-content table,
.page-content table {
    font-size: 14px;
}

/* Code blocks */
.post-content code,
.page-content code {
    font-size: 13px;
}

.post-content pre code,
.page-content pre code {
    font-size: 13px;
    line-height: 1.5;
}

/* About page specific */
.about-page .post-content,
.about .post-content {
    font-size: 15px;
}

.about-page h2,
.about h2 {
    font-size: 1.35rem; /* Slightly smaller for about page */
}

.about-page h3,
.about h3 {
    font-size: 1.1rem;
}

/* Emoji icons - keep reasonable size */
.post-content h2::before,
.page-content h2::before,
.post-content h3::before,
.page-content h3::before {
    font-size: 1.2em; /* Relative to heading size */
}

/* ============================================
   MOBILE RESPONSIVE - Even smaller on mobile
   ============================================ */
@media (max-width: 768px) {
    .post-content,
    .page-content {
        font-size: 14px;
    }
    
    .post-content h1,
    .page-content h1 {
        font-size: 1.5rem; /* 24px on mobile */
    }
    
    .post-content h2,
    .page-content h2 {
        font-size: 1.25rem; /* 20px on mobile */
    }
    
    .post-content h3,
    .page-content h3 {
        font-size: 1.1rem; /* 17.6px on mobile */
    }
    
    .post-content h4,
    .page-content h4 {
        font-size: 1rem; /* 16px on mobile */
    }
    
    .post-content p,
    .page-content p,
    .post-content li,
    .page-content li {
        font-size: 14px;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .nav,
    .social-icons,
    .theme-toggle,
    footer,
    #progress-bar {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
    
    /* Smaller fonts for printing */
    .post-content,
    .page-content {
        font-size: 11pt;
    }
    
    .post-content h1 { font-size: 18pt; }
    .post-content h2 { font-size: 15pt; }
    .post-content h3 { font-size: 13pt; }
}

/* ============================================
   ABOUT PAGE - OPTIMIZED LAYOUT
   ============================================ */

/* Reduce overall content width for better readability */
.post-content,
.page-content {
    max-width: 800px;
    margin: 0 auto;
}

/* Compact spacing for About page */
.post-content h2 {
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.post-content h3 {
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--primary-cyan);
}

/* Tighter paragraph spacing */
.post-content p {
    margin-bottom: 0.875rem;
}

/* Compact list styling */
.post-content ul,
.post-content ol {
    margin-bottom: 1rem;
    padding-left: 1.75rem;
}

.post-content li {
    margin-bottom: 0.35rem;
    line-height: 1.6;
}

/* Nested lists - even more compact */
.post-content ul ul,
.post-content ol ul,
.post-content ul ol,
.post-content ol ol {
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
}

/* Skills section - Grid layout for better space usage */
.post-content h3 + ul {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

/* Contact section - Compact grid */
.post-content h3#thông-tin-liên-lạc + ul,
.post-content h3#mạng-xã-hội + ul {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.4rem;
}

/* Blockquote - More compact */
.post-content blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
}

.post-content blockquote p {
    margin-bottom: 0;
    font-size: 14px;
}

/* Horizontal rule - Thinner */
.post-content hr {
    margin: 1.5rem 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

/* Links - Better visibility */
.post-content a {
    color: var(--primary-cyan);
    text-decoration: none;
    border-bottom: 1px dotted var(--primary-cyan);
    transition: all var(--transition-fast);
}

.post-content a:hover {
    color: var(--accent-cyan);
    border-bottom-style: solid;
}

/* Strong text - Slightly smaller */
.post-content strong {
    font-weight: 600;
    color: var(--text-primary);
}

/* Emoji in headings - Control size */
.post-content h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Remove excess spacing */
.post-content > *:first-child {
    margin-top: 0;
}

.post-content > *:last-child {
    margin-bottom: 0;
}

/* ============================================
   SKILLS CARDS - Better Visual Organization
   ============================================ */

/* Create card-like appearance for skill sections */
.post-content h2#-kỹ-năng-chuyên-môn ~ h3 {
    background: var(--bg-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary-cyan);
    margin-top: 1rem;
}

/* Compact project list */
.post-content h3#các-dự-án-đã-thực-hiện + ul {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.75rem;
}

.post-content h3#các-dự-án-đã-thực-hiện + ul li {
    background: var(--bg-secondary);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-teal);
    transition: all var(--transition-base);
}

.post-content h3#các-dự-án-đã-thực-hiện + ul li:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

/* ============================================
   MOBILE OPTIMIZATION
   ============================================ */
@media (max-width: 768px) {
    /* Single column on mobile */
    .post-content h3 + ul,
    .post-content h3#thông-tin-liên-lạc + ul,
    .post-content h3#mạng-xã-hội + ul,
    .post-content h3#các-dự-án-đã-thực-hiện + ul {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    /* Reduce padding on mobile */
    .post-content {
        padding: 1rem;
    }
    
    .post-content h2 {
        font-size: 1.15rem;
        margin-top: 1.5rem;
    }
    
    .post-content h3 {
        font-size: 1rem;
    }
    
    /* Smaller lists */
    .post-content ul,
    .post-content ol {
        padding-left: 1.25rem;
    }
}

/* ============================================
   COMPACT MODE - Extra tight spacing
   ============================================ */
@media (max-width: 480px) {
    .post-content {
        font-size: 13px;
    }
    
    .post-content h2 {
        font-size: 1.05rem;
        margin-top: 1.25rem;
        margin-bottom: 0.5rem;
    }
    
    .post-content h3 {
        font-size: 0.95rem;
        margin-top: 1rem;
        margin-bottom: 0.4rem;
    }
    
    .post-content p,
    .post-content li {
        font-size: 13px;
        margin-bottom: 0.5rem;
    }
    
    .post-content ul,
    .post-content ol {
        padding-left: 1rem;
    }
}