/* CSS Variables */
:root {
    --primary: #647FBC;
    --primary-dark: #4d669c;
    --accent: #FF6B6B;
    --bg: #f8fafc;
    --white: #ffffff;
    --text: #334155; /* slate-700 */
    --text-heading: #0f172a; /* slate-900 */
    --text-muted: #64748b; /* slate-500 */
    --border: #e2e8f0; /* slate-200 */
    --radius: 12px;
    --radius-lg: 32px; /* For the 3xl equivalent */
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); /* shadow-sm */
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --container: 1200px;
}

/* Base reset */
html {
    scroll-behavior: smooth;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Optimize font loading */
@font-face {
    font-family: 'Inter';
    font-display: swap; 
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 20px;
}

h1, h2, h3, h4 {
    line-height: 1.1;
    margin-bottom: 1rem;
    font-weight: 800;
    color: var(--text-heading);
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

ul {
    list-style: none;
}

.hidden {
    display: none !important;
}

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-gradient {
    background: linear-gradient(135deg, var(--primary), #a2bdf2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.mb-4 { margin-bottom: 1rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-4 { margin-top: 1rem; }
.font-bold { font-weight: 700; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Header */
.header {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1rem 0;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 800;
}

.logo-text {
    color: var(--text-heading);
    letter-spacing: -0.025em;
}

.logo-text span {
    color: var(--primary);
}

.logo-icon {
    background: var(--primary);
    color: white;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 20px;
}

.nav {
    display: flex;
    gap: 30px;
}

.nav-link {
    font-weight: 500;
    color: var(--text-muted);
}

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

/* Hero Section */
.hero {
    padding: 60px 0 80px;
    background: radial-gradient(circle at top right, rgba(100, 127, 188, 0.05), transparent);
    min-height: 500px;
}

.hero-title {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    letter-spacing: -0.04em;
    color: var(--text-heading);
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-muted);
    max-width: 650px;
    margin: 0 auto 3.5rem;
    font-weight: 400;
}

/* Upload Container */
.upload-container {
    background: var(--white);
    border: 2px dashed rgba(100, 127, 188, 0.3);
    border-radius: var(--radius-lg);
    padding: 80px;
    max-width: 850px;
    margin: 0 auto;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.upload-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom right, rgba(100, 127, 188, 0.05), transparent);
    pointer-events: none;
}

.upload-container:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.upload-zone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.upload-icon-wrapper {
    color: var(--primary);
    background: rgba(100, 127, 188, 0.1);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-bottom: 10px;
    transition: transform 0.3s ease;
}

.upload-container:hover .upload-icon-wrapper {
    transform: scale(1.1);
}

.hidden-input {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 32px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary { 
    background: var(--primary); 
    color: white; 
    box-shadow: 0 10px 15px -3px rgba(100, 127, 188, 0.3);
}

.btn-primary:hover { 
    background: var(--primary-dark); 
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(100, 127, 188, 0.3);
}

.btn-secondary { background: #f1f5f9; color: var(--text-heading); }
.btn-accent { 
    background: var(--accent); 
    color: white; 
    box-shadow: 0 10px 15px -3px rgba(255, 107, 107, 0.3);
}
.btn-light { background: white; color: var(--text-heading); border: 1px solid var(--border); }
.btn-sm { padding: 10px 24px; font-size: 14px; border-radius: 100px; }
.btn-lg { padding: 18px 48px; font-size: 1.125rem; border-radius: 16px; }

/* Editor Layout */
.editor-grid {
    display: grid;
    grid-template-columns: 450px 1fr;
    grid-template-areas: "tools preview";
    gap: 32px;
    align-items: start;
    text-align: left;
    justify-content: center;
}

.editor-tools-container { grid-area: tools; }
.editor-preview-container { 
    grid-area: preview; 
    position: relative;
    overflow: hidden;
}

/* Crop Overlay System */
.crop-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    user-select: none;
    touch-action: none;
}

.crop-workspace {
    position: relative;
    display: inline-block;
}

.crop-image {
    max-width: 100%;
    max-height: 70vh;
    display: block;
    pointer-events: none;
}

.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.crop-box {
    position: absolute;
    border: 2px solid white;
    box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.5);
    cursor: move;
    pointer-events: all;
    z-index: 10;
}

.crop-box::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border: 1px solid rgba(255, 255, 255, 0.3);
    pointer-events: none;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.1);
}

/* Grid Lines */
.crop-grid {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
}

.grid-h, .grid-v {
    position: absolute;
    background: rgba(255, 255, 255, 0.3);
}

.grid-h { width: 100%; height: 1px; left: 0; }
.grid-v { height: 100%; width: 1px; top: 0; }

.grid-h:nth-child(1) { top: 33.33%; }
.grid-h:nth-child(2) { top: 66.66%; }
.grid-v:nth-child(3) { left: 33.33%; }
.grid-v:nth-child(4) { left: 66.66%; }

/* Handles */
.crop-handle {
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border: 2px solid var(--primary);
    border-radius: 50%;
    z-index: 20;
}

.handle-nw { top: -10px; left: -10px; cursor: nw-resize; }
.handle-ne { top: -10px; right: -10px; cursor: ne-resize; }
.handle-sw { bottom: -10px; left: -10px; cursor: sw-resize; }
.handle-se { bottom: -10px; right: -10px; cursor: se-resize; }

.handle-n { top: -10px; left: 50%; transform: translateX(-50%); width: 30px; border-radius: 4px; cursor: n-resize; }
.handle-s { bottom: -10px; left: 50%; transform: translateX(-50%); width: 30px; border-radius: 4px; cursor: s-resize; }
.handle-e { right: -10px; top: 50%; transform: translateY(-50%); height: 30px; border-radius: 4px; cursor: e-resize; }
.handle-w { left: -10px; top: 50%; transform: translateY(-50%); height: 30px; border-radius: 4px; cursor: w-resize; }

.crop-dimensions {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
    pointer-events: none;
}

@media (max-width: 1100px) {
    .editor-grid { 
        grid-template-columns: 1fr; 
        grid-template-areas: "preview" "tools";
    }
}

.card {
    background: white;
    border-radius: 24px;
    border: 1px solid var(--border);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.editor-preview-container {
    position: sticky;
    top: 100px;
}

.preview-wrapper {
    padding: 30px;
    min-height: 450px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #f1f5f9;
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 20px 20px;
}

.preview-wrapper img {
    max-width: 100%;
    max-height: 500px;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    background: white;
}

.remove-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #ef4444;
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 24px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.remove-btn:hover { 
    transform: scale(1.1) rotate(90deg); 
    background: #dc2626; 
}

/* Tool Tabs */
.tool-tabs {
    display: flex;
    padding: 6px;
    background: #f1f5f9;
    margin: 15px;
    border-radius: 12px;
    gap: 2px;
}

.tab-btn {
    flex: 1;
    padding: 8px 4px;
    border: none;
    background: none;
    font-weight: 700;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 8px;
    white-space: nowrap;
}

.tab-btn.active {
    color: var(--primary);
    background: white;
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.tab-content-wrapper { padding: 0 25px 20px; min-height: auto; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Form Elements In Tabs */
.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 20px; }
.input-group label { display: block; margin-bottom: 6px; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.form-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #f8fafc;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(100, 127, 188, 0.1);
}

.checkbox-group { display: flex; flex-direction: column; gap: 10px; margin-top: 15px; }
.checkbox-label { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-heading); }
.checkbox-label input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--primary); border-radius: 5px; }

.format-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.btn-chip {
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: white;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-heading);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.btn-chip:hover:not(.active) {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: var(--primary);
}

.btn-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(100, 127, 188, 0.2);
}

.w-full { width: 100%; }
.range-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-top: 6px; font-weight: 600; }

/* Transform */
.transform-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Info Bar */
.info-bar {
    background: #f8fafc;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 15px 25px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.info-item { display: flex; flex-direction: column; gap: 2px; }
.info-label { font-size: 9px; font-weight: 800; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.1em; }
.info-value { font-size: 13px; font-weight: 800; color: var(--text-heading); }

.processing-actions { padding: 25px; background: white; }

#download-btn {
    background: #f1f5f9;
    color: var(--text-heading);
    border: 1px solid var(--border);
    box-shadow: none;
}

#download-btn:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
}

.block { display: block; }
.gap-2 { gap: 0.5rem; }

/* Sections */
.section { padding: 60px 0; }
.bg-light { background-color: var(--bg); }
.section-title { font-size: 2.5rem; margin-bottom: 1rem; }
.section-subtitle { font-size: 1.1rem; color: var(--text-muted); max-width: 600px; margin: 0 auto 3rem; }

.bg-white { background-color: white; }
.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.overflow-hidden { overflow: hidden; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.breadcrumb-nav {
    display: flex;
    justify-content: center;
    padding: 0.5rem 0 0.5rem;
}

.breadcrumb-nav ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.breadcrumb-nav li {
    display: flex;
    align-items: center;
}

.breadcrumb-nav a {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-nav a:hover {
    color: var(--primary);
}

.breadcrumb-nav [aria-current="page"] {
    color: var(--primary);
    font-weight: 600;
}

.security-item {
    transition: transform 0.3s ease;
}

.security-item:hover {
    transform: translateY(-5px);
}

.guide-link:hover {
    border-color: var(--primary);
    background-color: rgba(100, 127, 188, 0.02);
}

/* Optimization for CWV */
img {
    content-visibility: auto;
}

.hero {
    contain: layout style;
}
/* Dedicated Tool Mode */
.dedicated-tool-mode .tool-tabs {
    display: none !important;
}

.dedicated-tool-mode #related-tools-container {
    display: none !important;
}

#special-tool-controls.active {
    display: block !important;
}

#special-tool-controls .active {
    display: block !important;
}

.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.gap-2 { gap: 0.5rem; }
.my-4 { margin-top: 1rem; margin-bottom: 1rem; }
.p-4 { padding: 1rem; }
.bg-slate-50 { background-color: #f8fafc; }
.rounded-xl { border-radius: 0.75rem; }
.border-dashed { border-style: dashed; }
.border-slate-200 { border-color: #e2e8f0; }

/* Dedicated Tool Specific Hiding */
.mode-heic-to-jpg .format-grid button:not([data-format="image/jpeg"]),
.mode-discord-pfp-resizer .checkbox-group label:last-child,
.mode-resize-passport-photo .checkbox-group label:last-child {
    display: none !important;
}

.dedicated-tool-mode .info-bar .info-item:nth-child(4) {
    display: none !important;
}

.tools-grid-unified { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); display: grid; gap: 30px; }

.tool-card {
    background: var(--white);
    padding: 24px;
    border-radius: 20px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
}

.tool-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.tool-icon {
    font-size: 32px;
    margin-bottom: 16px;
    background: #f8fafc;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
}

.tools-grid-all {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.tool-item {
    background: white;
    padding: 12px 24px;
    border-radius: 100px;
    border: 1px solid var(--border);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tool-item:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f8fafc;
}

/* Modern Unified Tools Grid */
.tools-grid-unified {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-top: 40px;
}

.tool-card-fancy {
    background: var(--white);
    padding: 24px 20px;
    border-radius: 20px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.tool-card-fancy::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(100, 127, 188, 0.05), transparent);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tool-card-fancy:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(100, 127, 188, 0.1), 0 10px 10px -5px rgba(100, 127, 188, 0.04);
    border-color: var(--primary);
}

.tool-card-fancy:hover::before {
    opacity: 1;
}

.tool-icon-fancy {
    font-size: 32px;
    margin-bottom: 16px;
    background: #f8fafc;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.tool-card-fancy:hover .tool-icon-fancy {
    background: var(--primary);
    color: white;
    transform: scale(1.1) rotate(5deg);
}

.tool-card-fancy h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-heading);
}

.tool-card-fancy p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

@media (max-width: 1024px) {
    .tools-grid-unified {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .tools-grid-unified {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .tools-grid-unified {
        grid-template-columns: 1fr;
    }
    
    .tool-card-fancy {
        flex-direction: row;
        text-align: left;
        padding: 16px;
        align-items: center;
        gap: 16px;
    }
    
    .tool-icon-fancy {
        margin-bottom: 0;
        width: 48px;
        height: 48px;
        font-size: 24px;
        flex-shrink: 0;
    }
    
    .tool-card-fancy h3 {
        margin-bottom: 2px;
    }
}

/* Glass Card */
.glass-card {
    background: #ffffff;
    border: 1px solid var(--border);
    padding: 40px;
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.privacy-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f0fdf4;
    color: #166534;
    padding: 6px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    border: 1px solid #dcfce7;
}

/* FAQ */
.faq-container { max-width: 800px; margin: 0 auto; }
.faq-item { background: white; margin-bottom: 15px; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.faq-question { padding: 20px; font-weight: 600; cursor: pointer; display: flex; justify-content: space-between; }
.faq-answer { padding: 0 20px 20px; color: var(--text-muted); }

/* Blog */
.blog-card { background: white; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); transition: all 0.3s ease; }
.blog-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.blog-image { height: 200px; background-size: cover; background-position: center; }
.blog-content { padding: 25px; }

/* Ads */
.ad-wrapper { margin: 40px auto; text-align: center; }
.ad-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 8px; }
.ad-container { background: #f1f5f9; min-height: 100px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; overflow: hidden; }

/* Footer */
.footer { 
    background: #ffffff; 
    border-top: 1px solid var(--border);
    color: var(--text-muted); 
    padding: 80px 0 40px; 
}
.footer-col h4 { color: var(--text-heading); margin-bottom: 1.5rem; font-size: 1.1rem; }
.footer-link { display: block; color: var(--text-muted); margin-bottom: 0.8rem; font-size: 0.95rem; }
.footer-link:hover { color: var(--primary); }
.footer-bottom { border-top: 1px solid var(--border); margin-top: 60px; padding-top: 40px; color: var(--text-muted); }

/* Loader */
.loader-wrapper { display: flex; flex-direction: column; align-items: center; gap: 15px; padding: 40px; }
.loader { width: 48px; height: 48px; border: 5px solid var(--primary); border-bottom-color: transparent; border-radius: 50%; animation: rotation 1s linear infinite; }
@keyframes rotation { 0% { transform: rotate(0deg) } 100% { transform: rotate(360deg) } }

.success-msg { color: #059669; font-weight: 600; font-size: 1.1rem; margin-bottom: 20px; }

/* Responsive tweaks */
@media (max-width: 480px) {
    .hero-title { font-size: 2.2rem; }
    .btn-lg { width: 100%; padding: 14px; }
}

/* Blog Styles */
.blog-listing-hero {
    padding: 60px 0 40px;
    background: linear-gradient(to bottom, #f1f5f9, var(--bg));
    text-align: center;
}

.search-container {
    max-width: 600px;
    margin: 40px auto 0;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 16px 24px;
    padding-left: 48px;
    border-radius: 100px;
    border: 1px solid var(--border);
    font-size: 1rem;
    box-shadow: var(--shadow);
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.blog-featured {
    margin-bottom: 60px;
}

.featured-card {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    background: white;
    border-radius: 32px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
}

.featured-card:hover { transform: translateY(-5px); }

.featured-img {
    height: 100%;
    min-height: 400px;
    background-size: cover;
    background-position: center;
}

.featured-content {
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.category-badge {
    background: rgba(100, 127, 188, 0.1);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    margin-bottom: 12px;
}

.blog-filters {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 40px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.filter-btn {
    padding: 8px 20px;
    border-radius: 100px;
    background: white;
    border: 1px solid var(--border);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Individual Post Styles */
.blog-post-header {
    padding: 40px 0 30px;
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}

.post-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    color: var(--text-muted);
    font-size: 14px;
    margin: 20px 0;
}

.post-featured-image {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    border-radius: 32px;
    margin-bottom: 60px;
    box-shadow: var(--shadow-lg);
}

.post-layout {
    display: grid;
    grid-template-columns: 240px 1fr 240px;
    gap: 40px;
    align-items: start;
}

.post-sidebar-left {
    position: sticky;
    top: 120px;
}

.post-sidebar-right {
    position: sticky;
    top: 120px;
}

.post-content {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text);
}

.post-content h2 { margin-top: 2.5rem; margin-bottom: 1.5rem; font-size: 2rem; }
.post-content h3 { margin-top: 2rem; margin-bottom: 1rem; font-size: 1.5rem; }
.post-content p { margin-bottom: 1.5rem; }
.post-content ul, .post-content ol { margin-bottom: 1.5rem; padding-left: 20px; }
.post-content li { margin-bottom: 0.5rem; }

.toc {
    background: white;
    padding: 24px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.toc h4 { margin-bottom: 15px; font-size: 16px; }
.toc-list { font-size: 14px; list-style: none; padding: 0; }
.toc-list li { margin-bottom: 10px; }
.toc-list a { color: var(--text-muted); }
.toc-list a:hover { color: var(--primary); }

.share-btns {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.share-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.share-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.author-box {
    background: white;
    padding: 30px;
    border-radius: 20px;
    border: 1px solid var(--border);
    display: flex;
    gap: 20px;
    margin-top: 60px;
}

.author-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-size: cover;
}

.inline-cta {
    background: linear-gradient(135deg, var(--primary), #a2bdf2);
    padding: 40px;
    border-radius: 24px;
    color: white;
    text-align: center;
    margin: 60px 0;
}

.inline-cta h3 { color: white; }

.newsletter-section {
    background: #0f172a;
    padding: 80px 0;
    color: white;
    border-radius: 40px;
    margin: 80px 20px;
}

.newsletter-form {
    display: flex;
    max-width: 500px;
    margin: 30px auto 0;
    gap: 10px;
}

.newsletter-input {
    flex: 1;
    padding: 14px 20px;
    border-radius: 12px;
    border: none;
    font-family: inherit;
}

.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    background: var(--primary);
    z-index: 1001;
    width: 0;
}

@media (max-width: 1200px) {
    .post-layout { grid-template-columns: 1fr; }
    .post-sidebar-left, .post-sidebar-right { display: none; }
    .featured-card { grid-template-columns: 1fr; }
}

.breadcrumb {
    display: flex;
    gap: 10px;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

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

/* Related Articles */
.related-articles { margin-top: 80px; padding-top: 60px; border-top: 1px solid var(--border); }

.prose strong { color: var(--text-heading); font-weight: 700; }

.cta-section { background: var(--primary); padding: 80px 0; }
 
/* Unsaved Changes Modal */
.unsaved-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  opacity: 0;
  visibility: hidden;
  transition: 0.3s ease;
}

.unsaved-modal.active {
  opacity: 1;
  visibility: visible;
}

.unsaved-modal-content {
  width: 92%;
  max-width: 420px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px);
  border-radius: 28px;
  padding: 32px;
  text-align: center;
  box-shadow:
    0 25px 60px rgba(0,0,0,0.15),
    0 0 0 1px rgba(255,255,255,0.4);
  animation: modalPop 0.25s ease;
}

@keyframes modalPop {
  from {
    transform: scale(0.9) translateY(15px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.unsaved-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #647FBC, #8EA6E9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  color: white;
  box-shadow: 0 10px 25px rgba(100,127,188,0.35);
}

.unsaved-modal h3 {
  font-size: 28px;
  margin-bottom: 12px;
  color: #111827;
}

.unsaved-modal p {
  color: #6B7280;
  line-height: 1.6;
  margin-bottom: 28px;
  font-size: 15px;
}

.unsaved-actions {
  display: flex;
  gap: 14px;
}

.unsaved-actions button {
  flex: 1;
  border: none;
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.stay-btn {
  background: #EEF2FF;
  color: #647FBC;
}

.stay-btn:hover {
  background: #dfe7ff;
  transform: translateY(-2px);
}

.leave-btn {
  background: linear-gradient(135deg, #647FBC, #8EA6E9);
  color: white;
  box-shadow: 0 10px 25px rgba(100,127,188,0.35);
}

.leave-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(100,127,188,0.45);
}

@media (max-width: 600px) {
  .unsaved-modal-content {
    padding: 24px;
    border-radius: 22px;
  }

  .unsaved-actions {
    flex-direction: column;
  }
}
