/* ====================
   IDGov.Tech App - CSS
   ==================== */

/* Variables */
:root {
    --primary: #1A56DB;
    --primary-dark: #1E40AF;
    --secondary: #111827;
    --accent: #059669;
    --bg: #F9FAFB;
    --surface: #FFFFFF;
    --text: #111827;
    --text-secondary: #6B7280;
    --border: #E5E7EB;
    --warning: #F59E0B;
    --danger: #DC2626;
    --success: #059669;
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1 { font-size: 2rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.5rem; font-weight: 600; line-height: 1.3; }
h3 { font-size: 1.25rem; font-weight: 600; }
h4 { font-size: 1.125rem; font-weight: 600; }
p { margin-bottom: 1rem; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navbar */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 32px;
}
.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--secondary);
    text-decoration: none;
}
.logo-icon { font-size: 1.5rem; }
.nav-links {
    display: flex;
    gap: 8px;
    flex: 1;
}
.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
}
.nav-link:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--primary); color: white; }
.nav-auth { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.mobile-menu-btn { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #B91C1C; }
.btn-sm { padding: 6px 12px; font-size: 0.75rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-toggle::after {
    content: '▾';
    font-size: 0.75rem;
    margin-left: 4px;
}
.dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    display: none;
    z-index: 200;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
    display: block;
    padding: 10px 16px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.875rem;
}
.dropdown-item:hover { background: var(--bg); text-decoration: none; }

/* Flash Messages */
.flash-container {
    max-width: 1200px;
    margin: 16px auto;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}
.flash-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.flash-error { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.flash-info { background: #DBEAFE; color: #1E40AF; border: 1px solid #BFDBFE; }
.flash-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.flash-close { background: none; border: none; font-size: 1.25rem; cursor: pointer; padding: 0; margin-left: 12px; }

/* Main Content */
.main-content { flex: 1; }

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}
.card-header { margin-bottom: 16px; }

/* Tool Grid */
.tools-section { max-width: 1200px; margin: 0 auto; padding: 48px 24px; }
.section-header { margin-bottom: 32px; }
.section-title { font-size: 1.75rem; font-weight: 700; margin-bottom: 8px; }
.section-desc { color: var(--text-secondary); font-size: 1rem; }
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.tool-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all 0.15s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}
.tool-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
    text-decoration: none;
}
.tool-icon { font-size: 2.5rem; margin-bottom: 16px; display: block; }
.tool-name { font-size: 1.125rem; font-weight: 600; margin-bottom: 8px; }
.tool-desc { font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 16px; line-height: 1.5; }
.tool-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.category-badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    background: var(--bg);
    border-radius: 999px;
    color: var(--text-secondary);
    font-weight: 500;
}
.tool-hits { font-size: 0.75rem; color: var(--text-secondary); }

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #1E40AF 100%);
    color: white;
    padding: 80px 24px;
    text-align: center;
}
.hero-container { max-width: 800px; margin: 0 auto; }
.hero h1 { font-size: 2.5rem; margin-bottom: 16px; }
.hero p { font-size: 1.125rem; opacity: 0.9; max-width: 600px; margin: 0 auto 32px; }
.hero-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin-top: 48px;
    flex-wrap: wrap;
}
.stat-item { text-align: center; }
.stat-value { font-size: 2rem; font-weight: 700; }
.stat-label { font-size: 0.875rem; opacity: 0.8; }

/* Form Elements */
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 0.875rem;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: var(--font-sans);
    transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}
.form-textarea { resize: vertical; min-height: 120px; }
.form-helper { font-size: 0.75rem; color: var(--text-secondary); margin-top: 4px; }
.form-error { font-size: 0.75rem; color: var(--danger); margin-top: 4px; }
.form-input.error, .form-textarea.error { border-color: var(--danger); }

/* Auth Pages */
.auth-page {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
}
.auth-header { text-align: center; margin-bottom: 32px; }
.auth-header h1 { font-size: 1.5rem; margin-bottom: 8px; }
.auth-header p { color: var(--text-secondary); font-size: 0.875rem; margin: 0; }
.auth-footer { text-align: center; margin-top: 24px; font-size: 0.875rem; color: var(--text-secondary); }

/* Tool Page */
.tool-page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 48px 24px;
}
.tool-header { margin-bottom: 32px; }
.tool-header h1 { font-size: 2rem; margin-bottom: 8px; }
.tool-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.tool-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}
.panel-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.tool-output {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    background: #1F2937;
    color: #F9FAFB;
    padding: 16px;
    border-radius: var(--radius);
    min-height: 150px;
    white-space: pre-wrap;
    word-break: break-all;
}
.tool-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.copy-btn.copied { background: var(--accent); }

/* Admin */
.admin-page { max-width: 1200px; margin: 0 auto; padding: 48px 24px; }
.admin-header { margin-bottom: 32px; }
.admin-header h1 { font-size: 2rem; }
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 0.875rem; color: var(--text-secondary); }

/* Tables */
.table-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: left; }
.table th {
    background: var(--bg);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}
.table tr:not(:last-child) td { border-bottom: 1px solid var(--border); }
.table tbody tr:hover { background: var(--bg); }

/* Badge */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-danger { background: #FEE2E2; color: #991B1B; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-info { background: #DBEAFE; color: #1E40AF; }

/* Footer */
.footer {
    background: var(--secondary);
    color: white;
    padding: 48px 24px;
    margin-top: auto;
}
.footer-container { max-width: 1200px; margin: 0 auto; text-align: center; }
.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    margin-bottom: 8px;
}
.footer-tagline { opacity: 0.7; font-size: 0.875rem; margin-bottom: 16px; }
.footer-copy { font-size: 0.75rem; opacity: 0.5; }

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    background: var(--secondary);
    color: white;
    border-radius: var(--radius);
    font-size: 0.875rem;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: slideIn 0.2s ease;
}
@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links, .nav-auth { display: none; }
    .mobile-menu-btn { display: block; margin-left: auto; }
    .tool-layout { grid-template-columns: 1fr; }
    .hero h1 { font-size: 1.75rem; }
    .hero-stats { gap: 24px; }
    .auth-card { padding: 24px; }
}

/* About Page */
.about-page { max-width: 800px; margin: 0 auto; padding: 48px 24px; }
.about-page h1 { font-size: 2rem; margin-bottom: 24px; }
.about-page h2 { font-size: 1.25rem; margin: 32px 0 16px; }
.about-page ul { margin-left: 24px; margin-bottom: 16px; }
.about-page li { margin-bottom: 8px; }

/* 404 */
.error-page {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
}
.error-page h1 { font-size: 6rem; color: var(--primary); margin-bottom: 16px; }
.error-page p { color: var(--text-secondary); margin-bottom: 24px; }
