/* ==========================================================================
   Master CSS - One Page Tools (SaaS Redesign)
   ========================================================================== */

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

:root {
    /* Color Palette */
    --primary: #e5322d;
    --primary-hover: #c42824;
    --primary-light: #fef2f2;
    --bg: #f8f9fa;
    --surface: #ffffff;
    --text-main: #1a1a1a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --dark: #0f172a;
    
    /* 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), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Border Radius */
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-pill: 50px;
    
    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

/* ==========================================================================
   Header (Glassmorphism)
   ========================================================================== */
header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: var(--shadow-sm);
    padding: 15px 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.5px;
}

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

.nav-links {
    display: flex;
    gap: 30px;
    list-style: none;
    align-items: center;
}

.nav-links a {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 15px;
}

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

.btn-header {
    background: var(--primary-light);
    color: var(--primary);
    padding: 8px 20px;
    border-radius: var(--radius-pill);
    font-weight: 600;
}

.btn-header:hover {
    background: var(--primary);
    color: white;
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
    text-align: center;
    padding: 80px 20px 60px;
    background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--border);
}

.hero h1 {
    font-size: 48px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 20px;
    letter-spacing: -1px;
    line-height: 1.2;
}

.hero h1 span {
    color: var(--primary);
}

.hero p {
    font-size: 20px;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
    font-weight: 400;
}

/* ==========================================================================
   Grid & Tool Cards
   ========================================================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 20px;
    flex: 1;
}

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

.tool-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 30px 24px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(229, 50, 45, 0.3); /* Subtle primary tint */
}

.tool-icon {
    font-size: 40px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: var(--primary-light);
    border-radius: 24px;
    transition: var(--transition);
}

.tool-card:hover .tool-icon {
    transform: scale(1.05);
}

.tool-card h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-main);
}

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

.badge-new {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   Tool Pages (App Focus Layout)
   ========================================================================== */
.tool-wrapper {
    width: 100%;
    max-width: 728px;
    margin: 40px auto;
    padding: 0;
    flex: 1;
}

.tool-box {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-md);
    text-align: center;
    border: 1px solid var(--border);
}

.tool-box h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.tool-box > p {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 30px;
}

/* Premium Upload Area */
.upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-xl);
    padding: 60px 20px;
    background: #f8fafc;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
}

.upload-area::before {
    content: '📁'; /* Default icon */
    font-size: 48px;
    opacity: 0.8;
}

.upload-area p {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

/* Buttons */
.btn-process {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-pill);
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(229, 50, 45, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}
details.inner-d {
    padding: 15px;
}

.btn-process:hover, .download-btn:hover, .download-single:hover {
    background: #d62828;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(229, 50, 45, 0.4);
}

.btn-process:disabled {
    background: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-success {
    background: #10b981;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: #059669;
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4);
}

/* Fallback for older download buttons */
.download-btn, .download-single {
    background: #10b981;
    color: white;
    border: none;
    border-radius: var(--radius-pill);
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 15px;
    text-decoration: none;
}

/* Ads Integration */
.ad-container {
    width: calc(100% - 40px);
    max-width: 728px;
    height: 90px;
    margin: 30px auto;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
    background: var(--dark);
    color: #f8fafc;
    padding: 60px 20px 20px;
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col h4 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 12px;
}

.footer-col ul li a {
    color: #94a3b8;
    font-size: 14px;
}

.footer-col ul li a:hover {
    color: #ffffff;
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    color: #64748b;
    font-size: 13px;
}

/* ==========================================================================
   Responsive Utilities
   ========================================================================== */
@media (max-width: 768px) {
    .tool-wrapper {
        padding: 0 20px;
    }
    .nav-links { display: none; } /* Add mobile menu later if needed */
    
    .hero h1 { font-size: 36px; }
    .hero p { font-size: 16px; }
    
    .tool-box { padding: 25px 15px; }
    .tool-box h1 { font-size: 24px; }
    
    .ad-container { max-width: 355px; height: 60px; } /* Mobile Ad size */
    
    .footer-container {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Tool Specific UI (Compress, Page Numbers, etc)
   ========================================================================== */
.file-info {
    display: none;
    margin: 20px 0;
    padding: 15px;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-main);
    text-align: left;
}

.file-info strong {
    color: var(--dark);
}

.compression-levels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin: 15px 0 30px;
}

.level-card {
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px 15px;
    cursor: pointer;
    transition: var(--transition);
    background: var(--surface);
    text-align: center;
}

.level-card h4 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--text-main);
}

.level-card p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

.level-card:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.level-card.active {
    border-color: var(--primary);
    background: var(--primary-light);
}

.level-card.active h4 {
    color: var(--primary);
}

/* ==========================================================================
   Tool Internals (File Lists, Options)
   ========================================================================== */
.file-list-container {
    display: none;
    margin-top: 20px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 15px;
    max-height: 250px;
    overflow-y: auto;
    text-align: left;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: white;
    border: 1px solid var(--border);
    margin-bottom: 8px;
    border-radius: 6px;
    box-shadow: var(--shadow-sm);
}

.file-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
}

.remove-btn {
    color: var(--primary);
    cursor: pointer;
    font-weight: bold;
    padding: 5px;
    border-radius: 4px;
}
.remove-btn:hover {
    background: var(--primary-light);
}

/* ==========================================================================
   SEO Article & Typography (Enhanced Design)
   ========================================================================== */
.seo-article-container {
    width: calc(100% - 40px);
    max-width: 728px;
    margin: 40px auto;
    padding: 50px;
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: 0 10px 30px rgba(0,0,0,0.03); /* Softer, premium shadow */
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.seo-article-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #ff7e67);
}

.seo-article-container h1, 
.seo-article-container h2, 
.seo-article-container h3 {
    color: var(--text-main);
    margin-top: 35px;
    margin-bottom: 15px;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.3;
}

@media (max-width: 768px) {
    .seo-article-container {
        padding: 30px 20px;
    }
}

.seo-article-container h1:first-child {
    margin-top: 0;
}

.seo-article-container h1 { font-size: 28px; }
.seo-article-container h2 { font-size: 22px; color: #334155; }
.seo-article-container h3 { font-size: 18px; color: #475569; }

.seo-article-container p,
.seo-article-container li {
    font-size: 16px;
    color: #475569;
    line-height: 1.8;
    margin-bottom: 20px;
}

.seo-article-container ul,
.seo-article-container ol {
    margin-bottom: 25px;
    background: #f8fafc;
    padding: 20px 20px 20px 40px;
    border-radius: var(--radius-md);
    border-left: 3px solid var(--primary);
}

.seo-article-container li {
    margin-bottom: 10px;
}

.seo-article-container strong {
    color: var(--text-main);
    font-weight: 700;
}

/* FAQs */
.faq-section details {
    margin-bottom: 15px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.faq-section summary {
    padding: 15px 20px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-main);
    background: #f1f5f9;
    list-style: none;
    display: flex;
    justify-content: space-between;
}

.faq-section summary::-webkit-details-marker {
    display: none;
}

.faq-section summary::after {
    content: '+';
    font-size: 18px;
    color: var(--primary);
    font-weight: bold;
}

.faq-section details[open] summary::after {
    content: '-';
}

.faq-content {
    padding: 20px;
    border-top: 1px solid var(--border);
    background: white;
}

.faq-content p {
    margin-bottom: 0;
}

/* ==========================================================================
   Watermark UI Styles
   ========================================================================== */
.tab-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
    background: #f1f5f9;
    padding: 5px;
    border-radius: var(--radius-md);
    display: inline-flex;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition);
}

.tab-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.input-group {
    margin-bottom: 25px;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-main);
}

.input-field {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 16px;
    transition: var(--transition);
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.image-upload-wrapper {
    margin-bottom: 15px;
}

.image-upload-label {
    display: block;
    padding: 20px;
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-md);
    background: #f8fafc;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition);
}

.image-upload-label:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.wmPreview-thumb {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
    display: none;
    margin-top: 15px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}
.hidden { display: none !important; }

/* ==========================================================================
   Tool Action Buttons & Instructions (Rotate, Organize, Edit)
   ========================================================================== */
.global-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
}

.edit-btn {
    padding: 10px 24px;
    border: 1px solid var(--border);
    background: white;
    color: var(--text-main);
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

.edit-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.instruction-text {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    padding: 15px 25px;
    border-radius: var(--radius-md);
    font-size: 15px;
    margin-bottom: 25px;
    display: inline-block;
}