:root {
    --primary: #2563eb; --primary-dark: #1d4ed8; --bg: #f8fafc; --card-bg: #ffffff;
    --text: #1e293b; --text-muted: #64748b; --border: #e2e8f0; --success: #10b981; --error: #ef4444;
    --highlight-bg: #eff6ff;
}
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', -apple-system, sans-serif; }
body { background: var(--bg); color: var(--text); line-height: 1.6; }

/* Browser Warning Banner */
#browser-warning { display: none; background: #fef3c7; color: #92400e; padding: 16px 24px; text-align: center; font-weight: 600; border-bottom: 1px solid #fde68a; }
#browser-warning.show { display: block; }

/* Navbar */
header { background: var(--card-bg); border-bottom: 1px solid var(--border); padding: 16px 0; position: sticky; top: 0; z-index: 100; }
.nav-container { max-width: 1200px; margin: 0 auto; padding: 0 24px; display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 1.25rem; font-weight: 800; color: var(--primary); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.nav-links { display: flex; gap: 32px; align-items: center; }
.nav-links > a { color: var(--text-muted); text-decoration: none; font-weight: 500; transition: color 0.2s; }
.nav-links > a:hover { color: var(--primary); }

/* Multi-level Dropdown CSS */
.dropdown { position: relative; }
.dropdown > a { color: var(--text-muted); text-decoration: none; font-weight: 500; cursor: pointer; }
.dropdown:hover > a { color: var(--primary); }

/* Align main dropdown to the RIGHT edge so it doesn't hit the screen edge */
.dropdown-content { 
    display: none; position: absolute; top: 100%; right: 0; left: auto; 
    background: white; box-shadow: 0 4px 12px rgba(0,0,0,0.1); border-radius: 8px; 
    border: 1px solid var(--border); min-width: 200px; z-index: 20; padding: 8px 0; 
}
.dropdown:hover > .dropdown-content { display: block; }

.dropdown-submenu { position: relative; }
.dropdown-submenu > a { 
    padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; 
    color: var(--text); text-decoration: none; font-weight: 500; border-bottom: 1px solid var(--border); 
}
.dropdown-submenu:last-child > a { border-bottom: none; }
/* Point arrow to the LEFT */
.dropdown-submenu > a::after { content: '◂'; margin-left: 12px; color: var(--text-muted); }
.dropdown-submenu:hover > a { background: var(--bg); color: var(--primary); }

.submenu-content::before {
    content: '';
    position: absolute;
    right: -20px;
    top: 0;
    width: 20px;
    height: 100%;
    /* background: red; */ /* debug: makes the bridge visible */
}

/* Make sub-menu FLY OUT TO THE LEFT */
.submenu-content { 
    display: none; position: absolute; top: -9px; right: 100%; left: auto; 
    background: white; box-shadow: 0 4px 12px rgba(0,0,0,0.1); border-radius: 8px; 
    border: 1px solid var(--border); min-width: 200px; z-index: 21; padding: 8px 0; 
    margin-right: 8px; /* Gap between menus */
}
.dropdown-submenu:hover > .submenu-content { display: block; }

.submenu-content a { padding: 10px 16px; display: block; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border); }
.submenu-content a:last-child { border-bottom: none; }
.submenu-content a:hover { background: var(--bg); color: var(--primary); }
.submenu-content a.disabled { color: #94a3b8; cursor: not-allowed; }

/* Main Layout */
main { max-width: 1000px; margin: 0 auto; padding: 40px 24px 80px; }

/* Hero Section */
.hero { text-align: center; margin-bottom: 60px; }
.hero h1 { font-size: 2.8rem; font-weight: 800; margin-bottom: 16px; line-height: 1.2; }
.hero p { font-size: 1.2rem; color: var(--text-muted); max-width: 700px; margin: 0 auto; }
.security-badge { display: inline-flex; align-items: center; gap: 8px; background: #ecfdf5; color: var(--success); padding: 8px 16px; border-radius: 50px; font-weight: 600; font-size: 0.9rem; border: 1px solid #a7f3d0; margin-bottom: 24px; }

/* Sections */
section { margin-bottom: 60px; }
section h2 { font-size: 2rem; margin-bottom: 16px; text-align: center; }
section > p.intro { text-align: center; color: var(--text-muted); max-width: 700px; margin: 0 auto 40px; }

/* Grid & Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; padding: 32px; box-shadow: 0 4px 20px rgba(0,0,0,0.03); }

.card.highlight { border: 2px solid var(--primary); background: var(--highlight-bg); transform: scale(1.02); }
.card h3 { font-size: 1.5rem; margin-bottom: 8px; }
.card p.sub { color: var(--text-muted); margin-bottom: 24px; }

.sec-icon { font-size: 32px; margin-bottom: 12px; }
.tool-icon { font-size: 48px; margin-bottom: 16px; }
.tool-link { display: inline-block; margin-top: 16px; color: var(--primary); font-weight: 600; text-decoration: none; }
.tool-link:hover { text-decoration: underline; }

/* Upload Area */
.upload-area { border: 2px dashed var(--border); border-radius: 12px; padding: 48px; text-align: center; transition: all 0.3s; cursor: pointer; position: relative; }
.upload-area:hover { border-color: var(--primary); background: #f8fafc; }
.upload-area.dragover { border-color: var(--primary); background: #eff6ff; }
.upload-area input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-icon { font-size: 48px; margin-bottom: 12px; }

/* File List */
.file-list { margin-top: 16px; max-height: 200px; overflow-y: auto; }
.file-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: #f8fafc; border-radius: 8px; margin-bottom: 8px; border: 1px solid var(--border); font-size: 0.95rem; }
.file-item .name { font-weight: 500; word-break: break-all; margin-right: 10px; }
.file-item .size { color: var(--text-muted); font-size: 0.85rem; white-space: nowrap; }
.file-item .remove { background: none; border: none; color: var(--error); cursor: pointer; font-size: 1.2rem; margin-left: 10px; }

/* Progress Bar */
.progress-container { margin-top: 16px; display: none; }
.progress-bar-bg { width: 100%; height: 6px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; width: 0%; background: var(--primary); transition: width 0.2s; }
.progress-text { text-align: center; margin-top: 8px; font-weight: 600; font-size: 0.9rem; word-break: break-word; }

/* Buttons */
.btn { background: var(--primary); color: white; border: none; padding: 16px 32px; border-radius: 8px; font-size: 1rem; cursor: pointer; font-weight: 600; transition: all 0.2s; margin-top: 24px; width: 100%; }
.btn:hover:not(:disabled) { background: var(--primary-dark); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn .spinner { display: none; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.8s linear infinite; margin-right: 8px; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* FAQ Details */
details { background: white; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; padding: 16px; cursor: pointer; }
summary { font-weight: 600; font-size: 1.1rem; }
details[open] summary { margin-bottom: 12px; }
details p { color: var(--text-muted); line-height: 1.6; }

/* Footer */
footer { text-align: center; padding: 32px; color: var(--text-muted); border-top: 1px solid var(--border); background: white; margin-top: 40px; }