/* =========================================================
   SMARTPDFNOW — GLOBAL STYLESHEET
   Design system: paper + ink + highlighter
   (kept in sync with the token overrides in layouts/header.php)
========================================================= */

/* --- 1. CSS VARIABLES (LIGHT & DARK MODE) --- */
:root {
    --light-bg: #F5F6F2;
    --primary-color: #0E6E6A;
    --secondary-color: #F2A93B;
    --text-color: #131B2E;
    --text-muted: #5B6478;
    --card-bg: #ffffff;
    --header-bg: rgba(255, 255, 255, 0.92);
    --border: #E4E7E1;
    --header-height: 65px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-subtle: 0 4px 16px rgba(19, 27, 46, 0.06);
    --shadow-lift: 0 14px 30px rgba(19, 27, 46, 0.12);
    --transition-speed: 0.25s;
    --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
    --font-body: 'Inter', 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

html.dark-theme {
    --light-bg: #10141A;
    --card-bg: #1A2029;
    --header-bg: rgba(20, 24, 31, 0.92);
    --text-color: #E7EAEE;
    --text-muted: #9AA3B2;
    --border: #2A313C;
    --primary-color: #3FBDB5;
    --shadow-subtle: 0 4px 16px rgba(0, 0, 0, 0.35);
    --shadow-lift: 0 14px 30px rgba(0, 0, 0, 0.45);
}

/* --- 2. GLOBAL RESET --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--light-bg);
    color: var(--text-color);
    font-family: var(--font-body);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .site-title, .logo a, .text-logo {
    font-family: var(--font-display);
    letter-spacing: -0.01em;
}

/* Hide Google Translate Banner */
.goog-te-banner-frame { display: none !important; }
body { top: 0px !important; }

/* --- 3. HEADER & LOGO --- */
.header {
    background-color: var(--header-bg);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
    height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    transition: background-color var(--transition-speed);
}

.logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    font-size: 1.5em;
    font-weight: 700;
    color: var(--text-color);
    gap: 8px;
    letter-spacing: -0.02em;
}

.logo .pro-text {
    font-family: var(--font-mono);
    font-size: 0.55em;
    font-weight: 600;
    color: var(--secondary-color);
    background: rgba(242, 169, 59, 0.14);
    padding: 3px 7px;
    border-radius: 6px;
    margin-left: 4px;
    vertical-align: middle;
}

/* --- 4. DESKTOP NAVIGATION --- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.desktop-nav {
    list-style: none;
    display: none;
    margin: 0;
    padding: 0;
    gap: 4px;
}

.desktop-nav li a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    font-size: 0.93em;
    padding: 9px 16px;
    border-radius: 30px;
    transition: color var(--transition-speed), background var(--transition-speed);
}

.desktop-nav li a:hover,
.desktop-nav li a.active {
    color: var(--primary-color);
    background: rgba(14, 110, 106, 0.08);
}

.action-icon {
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-color);
    transition: var(--transition-speed);
}

.action-icon:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

/* --- 5. LANGUAGE DROPDOWN --- */
.lang-wrapper {
    position: relative;
}

.lang-btn {
    background: transparent;
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-color);
    transition: var(--transition-speed);
}

.lang-btn:hover {
    background: var(--light-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.lang-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 120%;
    background: var(--card-bg);
    border: 1px solid var(--border);
    width: 220px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lift);
    z-index: 1100;
    max-height: 300px;
    overflow-y: auto;
}

.lang-dropdown.show {
    display: block;
    animation: fadeInUp 0.18s ease;
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    font-size: 0.9em;
}

.lang-option:hover {
    background: var(--light-bg);
    color: var(--primary-color);
}

/* --- 6. FLOATING DARK MODE TOGGLE --- */
.theme-toggle-float {
    position: fixed;
    bottom: 25px;
    left: 25px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--card-bg);
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: var(--shadow-lift);
    z-index: 9999;
    border: 1px solid var(--border);
    transition: var(--transition-speed);
}

.theme-toggle-float:hover {
    transform: translateY(-3px);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* --- 7. TOP-TO-BOTTOM APP INSTALL POPUP --- */
.install-popup {
    position: fixed;
    top: -150px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 15px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lift);
    z-index: 100001;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: top 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    width: 90%;
    max-width: 400px;
}

.install-popup.show {
    top: 80px;
}

.install-popup img {
    width: 45px;
    height: 45px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.install-popup-text {
    flex-grow: 1;
}

.install-popup-text h4 {
    margin: 0 0 2px 0;
    font-size: 1rem;
    color: var(--text-color);
}

.install-popup-text p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.btn-install {
    background: var(--secondary-color);
    color: #14203A;
    border: none;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-speed);
}

.btn-install:hover {
    filter: brightness(0.94);
}

.btn-close-popup {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 5px;
}

/* --- 8. SEARCH OVERLAY --- */
.search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(245, 246, 242, 0.95);
    backdrop-filter: blur(10px);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 10vh;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-speed);
}

html.dark-theme .search-overlay {
    background: rgba(16, 20, 26, 0.96);
}

.search-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.search-input-box {
    width: 90%;
    max-width: 700px;
    padding: 18px 25px;
    font-size: 1.2rem;
    border: 2px solid var(--border);
    border-radius: 50px;
    background: var(--card-bg);
    color: var(--text-color);
    outline: none;
}

.search-input-box:focus {
    border-color: var(--primary-color);
}

/* --- 9. MOBILE MENU & HAMBURGER --- */
.burger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    width: 28px;
}

.burger span {
    height: 3px;
    background: var(--text-color);
    border-radius: 2px;
    width: 100%;
}

.side-menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 280px;
    background: var(--card-bg);
    z-index: 10000;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lift);
}

.side-menu.open {
    transform: translateX(0);
}

.menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(19, 27, 46, 0.4);
    z-index: 9999;
    display: none;
}

/* --- 10. TOOL GRID / CARDS (signature dog-eared corner) --- */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    padding-bottom: 30px;
}

.tool-card {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.25s ease;
}

.tool-card::after {
    content: '';
    position: absolute; top: 0; right: 0;
    width: 0; height: 0;
    border-style: solid;
    border-width: 0 0 16px 16px;
    border-color: transparent transparent transparent var(--light-bg);
    transition: border-width 0.25s ease;
}

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

.tool-card:hover::after {
    border-width: 0 0 22px 22px;
    border-color: transparent transparent transparent var(--secondary-color);
    opacity: 0.35;
}

.tool-card a {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: row;
    padding: 14px;
    height: 100%;
    box-sizing: border-box;
    gap: 12px;
    align-items: center;
}

.tool-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4em;
    flex-shrink: 0;
    box-shadow: 0 3px 8px rgba(19, 27, 46, 0.05);
}

.tool-text-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.tool-card h3 {
    margin: 0 0 3px 0;
    font-size: 1.02em;
    color: var(--text-color);
    font-weight: 700;
    line-height: 1.2;
    transition: color 0.25s ease;
}

.tool-card:hover h3 {
    color: var(--primary-color);
}

.tool-short-desc {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.85em;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-weight: 400;
}

/* --- 11. ANIMATIONS & RESPONSIVE BREAKPOINTS --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 992px) {
    .desktop-nav { display: flex; }
    .burger { display: none; }
}

@media (max-width: 600px) {
    .install-popup.show { top: 75px; }
}

/* --- 12. LAYOUT SHELL & ADS CONTAINER --- */
.main-content-area { flex-grow: 1; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; width: 100%; }

.responsive-ad-container {
    margin: 15px auto;
    text-align: center;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
@media (min-width: 992px) {
    .responsive-ad-container { min-height: 90px; }
}
