/*
 * ============================================================
 *  CyberSafe Tools — Simple Stylesheet
 *  Subject: ICT (HTML, CSS, JavaScript)
 * ============================================================
 *
 *  CSS Structure:
 *  1. CSS Variables (colours, fonts)
 *  2. Reset & Base Styles
 *  3. Navigation Bar
 *  4. Hero Section
 *  5. Cards & Sections
 *  6. Tool Panels & Forms
 *  7. Info/Learn Page
 *  8. Footer
 *  9. Utilities & Mobile Layout
 * ============================================================
 */

/* ── 1. CSS Variables ───────────────────────────────────────
   We define colours here once and reuse them throughout.     */
:root {
    --bg-dark:       #0d1117;   /* Page background */
    --bg-card:       #161b22;   /* Card background */
    --bg-panel:      #1c2128;   /* Input/panel background */
    --accent-green:  #3fb950;   /* Green accent */
    --accent-blue:   #58a6ff;   /* Blue accent */
    --text-primary:  #e6edf3;   /* Main text */
    --text-secondary:#8b949e;   /* Secondary / muted text */
    --border-color:  #30363d;   /* Borders */
    --danger:        #f85149;   /* Red */
    --success:       #3fb950;   /* Green */
    --font-main:    'Segoe UI', system-ui, sans-serif;
    --font-mono:    'Courier New', Consolas, monospace;
    --radius:        8px;
}

/* ── 2. Reset & Base Styles ─────────────────────────────────*/
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html { scroll-behavior: auto; }

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
}
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
    font-weight: 700;
    line-height: 1.3;
}

/* ── 3. Navigation Bar ──────────────────────────────────────*/
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.nav-brand .shield-icon { font-size: 1.3rem; }
.nav-brand span { color: var(--accent-green); }

.nav-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-decoration: none;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
    text-decoration: none;
}

.nav-links a.active {
    color: var(--accent-green);
}

/* ── 4. Hero Section ────────────────────────────────────────*/
.hero {
    padding: 60px 2rem 50px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.hero-badge {
    display: inline-block;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 20px;
}

.hero h1 {
    font-size: 2.4rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.hero h1 .highlight { color: var(--accent-green); }

.hero p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 540px;
    margin: 0 auto 32px;
}

.hero-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── Buttons ────────────────────────────────────────────────*/
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-green);
    color: #0d1117;
    border-color: var(--accent-green);
}
.btn-primary:hover { text-decoration: none; background: #56d364; }

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-color);
}
.btn-secondary:hover { text-decoration: none; border-color: var(--text-secondary); }

.btn-tool {
    background: var(--accent-blue);
    color: #0d1117;
    padding: 8px 18px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
}
.btn-tool:hover { text-decoration: none; background: #79c0ff; }

/* ── 5. Cards & Sections ────────────────────────────────────*/
.section {
    padding: 60px 2rem;
    max-width: 1100px;
    margin: 0 auto;
}

.section-header {
    text-align: center;
    margin-bottom: 40px;
}

.section-header h2 { font-size: 1.8rem; margin-bottom: 8px; }
.section-header p  { color: var(--text-secondary); }

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

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 28px;
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 12px;
    display: block;
}

.card h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.card p {
    color: var(--text-secondary);
    font-size: 0.93rem;
    margin-bottom: 18px;
    line-height: 1.6;
}

.badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
}

.badge-active {
    background: rgba(63,185,80,0.12);
    color: var(--accent-green);
    border-color: rgba(63,185,80,0.3);
}

.badge-soon {
    background: var(--bg-panel);
    color: var(--text-secondary);
}

/* ── 6. Tool Panels & Forms ─────────────────────────────────*/
.tools-page {
    max-width: 820px;
    margin: 0 auto;
    padding: 48px 2rem;
}

.tool-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 30px;
    margin-bottom: 24px;
}

.tool-panel.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.tool-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.tool-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.tool-title { flex: 1; }
.tool-title h2 { font-size: 1.25rem; margin-bottom: 2px; }
.tool-title p  { color: var(--text-secondary); font-size: 0.88rem; }

/* Form controls */
.form-group { margin-bottom: 16px; }

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

input[type="text"],
input[type="number"],
textarea,
select {
    width: 100%;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: var(--font-main);
    outline: none;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--accent-green);
}

textarea { resize: vertical; min-height: 80px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* Result box */
.result-box {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 14px;
    font-family: var(--font-mono);
    font-size: 0.93rem;
    color: var(--accent-green);
    min-height: 48px;
    word-break: break-all;
    margin-top: 18px;
    position: relative;
}

.result-box .result-label {
    font-family: var(--font-main);
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: block;
}

.btn-copy {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 5px;
    cursor: pointer;
}

.tool-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.btn-run {
    background: var(--accent-green);
    color: #0d1117;
    padding: 10px 24px;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 0.93rem;
    cursor: pointer;
    border: none;
}

.btn-clear {
    background: transparent;
    color: var(--text-secondary);
    padding: 10px 18px;
    border-radius: var(--radius);
    font-size: 0.93rem;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

/* Status messages */
.msg {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    margin-top: 12px;
    display: none;
}
.msg.error   { background: rgba(248,81,73,0.1);  border: 1px solid rgba(248,81,73,0.3);  color: #ffa198; }
.msg.success { background: rgba(63,185,80,0.1);  border: 1px solid rgba(63,185,80,0.3);  color: #56d364; }
.msg.show    { display: block; }

/* Spinner */
.spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(0,0,0,0.2);
    border-top-color: #0d1117;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: none;
}
.spinner.show { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Tip box */
.tip-box {
    background: var(--bg-panel);
    border-left: 3px solid var(--accent-green);
    padding: 10px 14px;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 10px;
}
.tip-box strong { color: var(--text-primary); }

/* ── 7. Info / Learn Page ────────────────────────────────────*/
.learn-page {
    max-width: 820px;
    margin: 0 auto;
    padding: 48px 2rem;
}

.learn-hero {
    text-align: center;
    margin-bottom: 40px;
}

.learn-hero h1 { font-size: 2rem; margin-bottom: 10px; }
.learn-hero p  { color: var(--text-secondary); }

.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px;
}

.info-icon {
    font-size: 2rem;
    line-height: 1;
}

.info-card h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.info-card p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 10px;
}

/* ── 8. Footer ───────────────────────────────────────────────*/
.footer {
    border-top: 1px solid var(--border-color);
    padding: 32px 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.footer a { color: var(--accent-blue); }

/* ── 9. Utilities & Mobile Layout ────────────────────────────*/
.text-green  { color: var(--accent-green); }
.text-blue   { color: var(--accent-blue); }
.text-muted  { color: var(--text-secondary); }

/* Stats strip on homepage */
.stats-strip {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 28px 2rem;
}

.stats-grid {
    max-width: 800px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    text-align: center;
}

.stat-num  { font-size: 1.8rem; font-weight: 700; color: var(--accent-green); }
.stat-desc { font-size: 0.85rem; color: var(--text-secondary); margin-top: 2px; }

/* Page title bar for inner pages */
.page-title-bar {
    padding: 40px 2rem 0;
    max-width: 820px;
    margin: 0 auto;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 24px;
}

.page-title-bar h1 { font-size: 1.9rem; margin-bottom: 6px; }
.page-title-bar p  { color: var(--text-secondary); }

/* Code block */
pre, code {
    font-family: var(--font-mono);
    font-size: 0.88rem;
}

/* Responsive: stack on small screens */
@media (max-width: 600px) {
    .form-row          { grid-template-columns: 1fr; }
    .nav-links         { gap: 1rem; }
    .stats-grid        { grid-template-columns: 1fr; gap: 12px; }
    .info-card         { grid-template-columns: 1fr; gap: 10px; }
    .hero h1           { font-size: 1.8rem; }
    .tool-panel        { padding: 20px; }
    .navbar            { padding: 0 1rem; }
}
