/*
 * ToolBox — Design System
 * Premium dark-mode-first with glassmorphism, gradients & micro-animations
 */

/* ═══════════════════════════════════════════
   CSS CUSTOM PROPERTIES
   ═══════════════════════════════════════════ */
:root {
    /* Core palette - Light Theme */
    --tb-bg:             #f2f3f8;
    --tb-bg-secondary:   #ffffff;
    --tb-bg-tertiary:    #f1f3f5;
    --tb-surface:        rgba(0,0,0,0.02);
    --tb-surface-hover:  rgba(0,0,0,0.04);
    --tb-border:         rgba(0,0,0,0.08);
    --tb-border-hover:   rgba(0,0,0,0.12);

    /* Brand red (iLovePDF inspired) */
    --tb-primary:        #e5322d;
    --tb-primary-light:  #fdecea;
    --tb-primary-dark:   #c02621;
    --tb-secondary:      #1565c0;
    --tb-accent:         #f59e0b;
    --tb-gradient:       linear-gradient(135deg, #e5322d 0%, #ff5252 100%);
    --tb-gradient-warm:  linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    --tb-gradient-soft:  linear-gradient(135deg, rgba(229,50,45,0.05) 0%, rgba(229,50,45,0.1) 100%);

    /* Text */
    --tb-text:           #212529;
    --tb-text-muted:     #495057;
    --tb-text-dim:       #adb5bd;

    /* Status */
    --tb-success:        #10b981;
    --tb-warning:        #f59e0b;
    --tb-danger:         #ef4444;
    --tb-info:           #0ea5e9;

    /* Glass (Subtle for light mode) */
    --tb-glass-bg:       rgba(255,255,255,0.8);
    --tb-glass-border:   rgba(0,0,0,0.08);
    --tb-glass-blur:     10px;

    /* Shadows (Softer for light mode) */
    --tb-shadow-sm:      0 2px 8px rgba(0,0,0,0.04);
    --tb-shadow-md:      0 4px 20px rgba(0,0,0,0.06);
    --tb-shadow-lg:      0 8px 40px rgba(0,0,0,0.08);
    --tb-shadow-glow:    0 0 20px rgba(229,50,45,0.1);
    --tb-shadow-glow-lg: 0 0 40px rgba(229,50,45,0.15);

    /* Radius */
    --tb-radius-sm:  8px;
    --tb-radius-md:  12px;
    --tb-radius-lg:  16px;
    --tb-radius-xl:  24px;

    /* Transitions */
    --tb-transition:     all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --tb-transition-fast: all 0.15s ease;
}

/* ═══════════════════════════════════════════
   BASE STYLES
   ═══════════════════════════════════════════ */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--tb-bg);
    color: var(--tb-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

::selection {
    background: rgba(124,58,237,0.4);
    color: #fff;
}

a { color: var(--tb-primary); transition: var(--tb-transition-fast); }
a:hover { color: var(--tb-primary-dark); }

/* ═══════════════════════════════════════════
   NAVBAR
   ═══════════════════════════════════════════ */
.tb-navbar {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(var(--tb-glass-blur));
    -webkit-backdrop-filter: blur(var(--tb-glass-blur));
    border-bottom: 1px solid var(--tb-border);
    padding: 0.6rem 0;
    z-index: 1050;
}

.tb-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none !important;
}

.tb-brand-icon {
    font-size: 1.6rem;
    filter: drop-shadow(0 0 8px rgba(229,50,45,0.2));
}

.tb-brand-text {
    font-size: 1.3rem;
    font-weight: 800;
    background: var(--tb-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tb-dropdown {
    background: var(--tb-bg-secondary);
    border: 1px solid var(--tb-border);
    border-radius: var(--tb-radius-md);
    box-shadow: var(--tb-shadow-lg);
    padding: 0.5rem;
    min-width: 240px;
}

.tb-dropdown .dropdown-item {
    color: var(--tb-text-muted);
    border-radius: var(--tb-radius-sm);
    padding: 0.5rem 0.75rem;
    transition: var(--tb-transition-fast);
    font-size: 0.9rem;
}

.tb-dropdown .dropdown-item:hover {
    background: var(--tb-primary-light);
    color: var(--tb-primary);
    transform: translateX(4px);
}

.tb-dropdown .dropdown-header {
    color: var(--tb-text-dim);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.5rem 0.75rem 0.25rem;
}

.tb-dropdown .dropdown-divider {
    border-color: var(--tb-border);
    margin: 0.25rem 0;
}

.tb-badge-pro {
    background: var(--tb-gradient);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.35rem 0.7rem;
    border-radius: 50px;
    letter-spacing: 0.05em;
    animation: proGlow 2s ease-in-out infinite;
}

@keyframes proGlow {
    0%, 100% { box-shadow: 0 0 5px rgba(124,58,237,0.3); }
    50% { box-shadow: 0 0 15px rgba(124,58,237,0.6); }
}

/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */
.tb-btn-primary {
    background: var(--tb-gradient);
    border: none;
    color: #fff;
    font-weight: 600;
    border-radius: var(--tb-radius-sm);
    padding: 0.6rem 1.5rem;
    transition: var(--tb-transition);
    position: relative;
    overflow: hidden;
}

.tb-btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s;
}

.tb-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--tb-shadow-glow);
    color: #fff;
}

.tb-btn-primary:hover::before { opacity: 1; }
.tb-btn-primary:active { transform: translateY(0) scale(0.98); }

.tb-btn-outline {
    background: transparent;
    border: 1px solid var(--tb-border);
    color: var(--tb-text);
    font-weight: 500;
    border-radius: var(--tb-radius-sm);
    padding: 0.6rem 1.5rem;
    transition: var(--tb-transition);
}

.tb-btn-outline:hover {
    border-color: var(--tb-primary);
    color: var(--tb-primary-light);
    background: rgba(124,58,237,0.08);
}

/* ═══════════════════════════════════════════
   HERO SECTION
   ═══════════════════════════════════════════ */
.tb-hero {
    position: relative;
    padding: 5rem 0 3rem;
    overflow: hidden;
}

.tb-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -20%;
    width: 140%;
    height: 200%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(229,50,45,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(21,101,192,0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 0%, rgba(245,158,11,0.04) 0%, transparent 40%);
    animation: heroShift 15s ease-in-out infinite;
    z-index: 0;
}

@keyframes heroShift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(2%, -1%) scale(1.02); }
    66% { transform: translate(-1%, 1%) scale(0.99); }
}

.tb-hero > * { position: relative; z-index: 1; }

.tb-hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

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

.tb-hero p.lead {
    color: var(--tb-text-muted);
    font-size: 1.15rem;
    max-width: 600px;
    margin: 0 auto;
}

/* ═══════════════════════════════════════════
   TOOL CARDS
   ═══════════════════════════════════════════ */
.tool-card {
    background: #ffffff !important;
    border: 1px solid rgba(0,0,0,0.08) !important;
    border-radius: var(--tb-radius-xl);
    transition: var(--tb-transition);
    height: 100%;
    aspect-ratio: 1 / 1;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02), 0 2px 4px -1px rgba(0,0,0,0.02);
}

.tool-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--tb-gradient-soft);
    opacity: 0;
    transition: opacity 0.4s;
}

.tool-card:hover {
    border-color: var(--tb-primary) !important;
    transform: translateY(-8px);
    box-shadow: 0 12px 24px -10px rgba(0,0,0,0.1);
}

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

.tool-card .card-body {
    position: relative;
    z-index: 1;
}

.tool-card .tool-icon-wrap {
    width: 64px;
    height: 64px;
    border-radius: var(--tb-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    transition: var(--tb-transition);
}

/* Specific Tool Slug Colors (iLovePDF Style) */
.tool-card[data-slug*="split"], .tool-card[data-slug*="merge"], .tool-card[data-slug*="rotate"] .tool-icon-wrap {
    background: rgba(229,50,45,0.08); color: #e5322d;
}
.tool-card[data-slug*="compress"] .tool-icon-wrap {
    background: rgba(76,175,80,0.08); color: #4caf50;
}
.tool-card[data-slug*="word"] .tool-icon-wrap {
    background: rgba(66,133,244,0.08); color: #4285f4;
}
.tool-card[data-slug*="jpg"] .tool-icon-wrap {
    background: rgba(0,188,212,0.08); color: #00bcd4;
}
.tool-card[data-slug*="excel"] .tool-icon-wrap {
    background: rgba(46,125,50,0.08); color: #2e7d32;
}
.tool-card[data-slug*="powerpoint"] .tool-icon-wrap {
    background: rgba(255,109,0,0.08); color: #ff6d00;
}
.tool-card[data-slug*="edit"], .tool-card[data-slug*="ocr"] .tool-icon-wrap {
    background: rgba(124,58,237,0.08); color: #7c3aed;
}
.tool-card[data-slug*="img"] .tool-icon-wrap {
    background: rgba(21,101,192,0.08); color: #1565c0;
}

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

.tool-card .card-title {
    font-size: clamp(0.9rem, 1.2vw, 1.15rem);
    font-weight: 700;
    color: var(--tb-text);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.tool-card .card-text {
    font-size: clamp(0.75rem, 1vw, 0.85rem);
    color: var(--tb-text-muted) !important;
    line-height: 1.4;
    margin-bottom: auto; /* Push badges to bottom */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Badges */
.tb-badge-free {
    background: rgba(16,185,129,0.15);
    color: var(--tb-success);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
}

.tb-badge-premium {
    background: rgba(245,158,11,0.15);
    color: var(--tb-warning);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
}

.tb-badge-instant {
    background: rgba(6,182,212,0.15);
    color: var(--tb-info);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
}

/* ═══════════════════════════════════════════
   CATEGORY FILTER PILLS
   ═══════════════════════════════════════════ */
.tb-filter-pills .nav-link {
    color: var(--tb-text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: 50px;
    padding: 0.5rem 1.25rem;
    transition: var(--tb-transition);
    border: 1px solid transparent;
}

.tb-filter-pills .nav-link:hover {
    color: var(--tb-text);
    background: var(--tb-surface-hover);
}

.tb-filter-pills .nav-link.active {
    background: var(--tb-gradient);
    color: #fff;
    border-color: transparent;
}

/* ═══════════════════════════════════════════
   DROP ZONE
   ═══════════════════════════════════════════ */
.tb-drop-zone {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 5rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.tb-btn-huge {
    background: #e5322d;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    padding: 1.25rem 3.5rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(229,50,45,0.3);
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.tb-btn-huge:hover {
    background: #c02621;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(229,50,45,0.4);
    color: #fff;
}

.tb-drop-text {
    margin-top: 1rem;
    color: var(--tb-text-muted);
    font-size: 1.1rem;
    font-weight: 500;
}

/* ═══════════════════════════════════════════
   PRICING SECTION
   ═══════════════════════════════════════════ */
.tb-pricing-card {
    background: var(--tb-glass-bg);
    border: 1px solid var(--tb-glass-border);
    border-radius: var(--tb-radius-xl);
    padding: 2.5rem 2rem;
    transition: var(--tb-transition);
    position: relative;
}

.tb-pricing-card:hover {
    border-color: rgba(124,58,237,0.3);
    transform: translateY(-4px);
}

.tb-pricing-card.popular {
    border-color: var(--tb-primary);
    box-shadow: var(--tb-shadow-glow);
}

.tb-pricing-card.popular::before {
    content: 'BEST VALUE';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--tb-gradient);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    padding: 0.3rem 1rem;
    border-radius: 50px;
}

.tb-price {
    font-size: 3rem;
    font-weight: 800;
    background: var(--tb-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tb-price-period {
    font-size: 1rem;
    color: var(--tb-text-muted);
    font-weight: 400;
}

.tb-price-mini {
    background: var(--tb-surface);
    border: 1px solid var(--tb-border);
    border-radius: var(--tb-radius-md);
    padding: 0.75rem 1.25rem;
    text-align: center;
    min-width: 100px;
}

.tb-price-mini.tb-price-popular {
    border-color: var(--tb-primary);
    background: rgba(124,58,237,0.08);
}

/* ═══════════════════════════════════════════
   STATS SECTION
   ═══════════════════════════════════════════ */
.tb-stat-card {
    text-align: center;
    padding: 1.5rem;
}

.tb-stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--tb-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tb-stat-label {
    color: var(--tb-text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 0.25rem;
}

/* ═══════════════════════════════════════════
   FORM CONTROLS (dark theme)
   ═══════════════════════════════════════════ */
.tb-form-control {
    background: var(--tb-surface);
    border: 1px solid var(--tb-border);
    color: var(--tb-text);
    border-radius: var(--tb-radius-sm);
    padding: 0.65rem 1rem;
    transition: var(--tb-transition);
}

.tb-form-control:focus {
    background: var(--tb-bg-secondary);
    border-color: var(--tb-primary);
    color: var(--tb-text);
    box-shadow: 0 0 0 3px rgba(229,50,45,0.1);
}

.tb-form-control::placeholder { color: var(--tb-text-dim); }

/* ═══════════════════════════════════════════
   GLASS CARDS
   ═══════════════════════════════════════════ */
.tb-card {
    background: var(--tb-glass-bg);
    border: 1px solid var(--tb-glass-border);
    border-radius: var(--tb-radius-lg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.tb-card-header {
    border-bottom: 1px solid var(--tb-border);
    padding: 1rem 1.5rem;
}

/* ═══════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════ */
.tb-modal {
    background: var(--tb-bg-secondary);
    border: 1px solid var(--tb-border);
    border-radius: var(--tb-radius-xl);
}

/* ═══════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════ */
.tb-footer {
    background: var(--tb-bg-secondary);
    border-top: 1px solid var(--tb-border);
    margin-top: auto;
}

.tb-footer a:hover { color: var(--tb-primary) !important; }

/* ═══════════════════════════════════════════
   PROGRESS BAR
   ═══════════════════════════════════════════ */
.tb-progress {
    height: 6px;
    background: var(--tb-surface);
    border-radius: 50px;
    overflow: hidden;
}

.tb-progress-bar {
    height: 100%;
    background: var(--tb-gradient);
    border-radius: 50px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.tb-progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ═══════════════════════════════════════════
   TOOL PAGE LAYOUT
   ═══════════════════════════════════════════ */
.tb-tool-header {
    text-align: center;
    padding: 3rem 0 1.5rem;
}

.tb-tool-header .tool-page-icon {
    display: none; /* Hide icon to match iLovePDF */
}

.tb-tool-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #333333;
    margin-bottom: 0.75rem;
}

.tb-tool-header .tool-desc {
    display: block;
    color: #555555;
    font-size: 1.25rem;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.5;
}

.tb-tool-header .tb-badge-free,
.tb-tool-header .tb-badge-instant,
.tb-tool-header .tb-badge-premium {
    display: none; /* Hide badges in header to match iLovePDF */
}

/* ═══════════════════════════════════════════
   AUTH PAGES
   ═══════════════════════════════════════════ */
.tb-auth-page {
    min-height: calc(100vh - 70px);
    display: flex;
    align-items: center;
}

.tb-auth-card {
    background: var(--tb-glass-bg);
    border: 1px solid var(--tb-glass-border);
    border-radius: var(--tb-radius-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
}

/* ═══════════════════════════════════════════
   DASHBOARD
   ═══════════════════════════════════════════ */
.tb-dash-card {
    background: var(--tb-glass-bg);
    border: 1px solid var(--tb-glass-border);
    border-radius: var(--tb-radius-lg);
    padding: 1.5rem;
    transition: var(--tb-transition);
}

.tb-dash-card:hover {
    border-color: var(--tb-border-hover);
}

/* ═══════════════════════════════════════════
   TABLE (dark theme)
   ═══════════════════════════════════════════ */
.tb-table {
    color: var(--tb-text);
}

.tb-table thead th {
    background: var(--tb-surface);
    border-bottom: 1px solid var(--tb-border);
    color: var(--tb-text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
}

.tb-table tbody td {
    border-bottom: 1px solid var(--tb-border);
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

.tb-table tbody tr:hover {
    background: var(--tb-surface-hover);
}

/* ═══════════════════════════════════════════
   FEATURE ICONS ROW
   ═══════════════════════════════════════════ */
.tb-features {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
    padding: 2rem 0;
}

.tb-feature-item {
    text-align: center;
    max-width: 180px;
}

.tb-feature-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--tb-radius-md);
    background: var(--tb-primary-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--tb-primary);
    margin-bottom: 0.75rem;
}

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

.animate-in {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}

.animate-in:nth-child(1)  { animation-delay: 0.05s; }
.animate-in:nth-child(2)  { animation-delay: 0.10s; }
.animate-in:nth-child(3)  { animation-delay: 0.15s; }
.animate-in:nth-child(4)  { animation-delay: 0.20s; }
.animate-in:nth-child(5)  { animation-delay: 0.25s; }
.animate-in:nth-child(6)  { animation-delay: 0.30s; }
.animate-in:nth-child(7)  { animation-delay: 0.35s; }
.animate-in:nth-child(8)  { animation-delay: 0.40s; }
.animate-in:nth-child(9)  { animation-delay: 0.45s; }
.animate-in:nth-child(10) { animation-delay: 0.50s; }
.animate-in:nth-child(11) { animation-delay: 0.55s; }
.animate-in:nth-child(12) { animation-delay: 0.60s; }

/* Floating particles (hero background) */
@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

.tb-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--tb-primary);
    opacity: 0.2;
    animation: float 6s ease-in-out infinite;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
    .tb-hero { padding: 3rem 0 2rem; }
    .tb-hero h1 { font-size: 1.8rem; }
    .tb-pricing-card { padding: 2rem 1.5rem; }
    .tb-auth-card { padding: 1.75rem; margin: 1rem; }
    .tool-card .card-body { padding: 1rem !important; }
}

@media (max-width: 576px) {
    .tb-features { gap: 1rem; }
    .tb-feature-item { max-width: 140px; }
}

/* ═══════════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════════ */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--tb-bg); }
::-webkit-scrollbar-thumb {
    background: var(--tb-bg-tertiary);
    border-radius: 50px;
}
::-webkit-scrollbar-thumb:hover { background: var(--tb-primary); }
