:root {
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --secondary: #3b82f6;
    --bg-body: #0f172a;
    --bg-surface: rgba(30, 41, 59, 0.6);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(148, 163, 184, 0.15);
    --border-highlight: rgba(139, 92, 246, 0.4);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-body);
    background-image: radial-gradient(circle at 15% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 40%),
                      radial-gradient(circle at 85% 80%, rgba(59, 130, 246, 0.15) 0%, transparent 40%);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Navigation */
header {
    background-color: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

nav {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1.2rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.3rem;
    font-weight: 800;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #a78bfa, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo span {
    -webkit-text-fill-color: initial;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 1rem;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.nav-links a:hover {
    color: #fff;
    text-shadow: 0 0 10px rgba(255,255,255,0.3);
}

/* Main Content */
main {
    flex: 1;
    max-width: 800px;
    margin: 3rem auto;
    padding: 0 2rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeIn 0.8s ease forwards;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    margin-bottom: 1rem;
    color: #fff;
    line-height: 1.1;
    text-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 500px;
    margin: 0 auto;
}

/* Card - Glassmorphism */
.card {
    background-color: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-md);
    animation: slideUp 0.6s ease forwards;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

label {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
    letter-spacing: 0.02em;
}

input, select {
    width: 100%;
    padding: 0.85rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background-color: rgba(15, 23, 42, 0.8);
    color: #fff;
    transition: all 0.3s ease;
    outline: none;
    -webkit-appearance: none;
}

input:focus, select:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
    background-color: rgba(15, 23, 42, 0.95);
}

input::placeholder {
    color: #475569;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    border: none;
    width: auto;
    letter-spacing: 0.02em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    width: 100%;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}

.btn-outline {
    background-color: rgba(255,255,255,0.05);
    color: var(--text-main);
    border: 1px solid rgba(255,255,255,0.1);
}

.btn-outline:hover {
    background-color: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.3);
    color: #fff;
}

/* Loaders and Status */
.loader-container {
    display: none;
    text-align: center;
    padding: 3rem 0;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--secondary);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite;
    margin: 0 auto 1.5rem;
}

.result-container {
    display: none;
    text-align: center;
    width: 100%;
    background-color: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
}

.certificate-preview {
    background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
    border: 1px solid var(--border);
    padding: 2rem;
    border-radius: var(--radius-md);
    margin: 2rem 0;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.2);
}

.pdf-preview-wrapper {
    margin: 20px 0;
    width: 100%;
    height: 450px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-highlight);
    background: #0f172a;
    box-shadow: var(--shadow-glow);
}

.text-success {
    color: #34d399;
    font-weight: 500;
    margin-bottom: 1rem;
    text-shadow: 0 0 10px rgba(52, 211, 153, 0.3);
}

.text-error {
    color: #f87171;
    background-color: rgba(220, 38, 38, 0.1);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(248, 113, 113, 0.3);
    margin-bottom: 1rem;
    font-size: 0.95rem;
    text-align: left;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid var(--border);
    background-color: rgba(15, 23, 42, 0.5);
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: auto;
}

/* Animations */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 600px) {
    .hero h1 { font-size: 2.5rem; }
    .card, .result-container { padding: 1.5rem; border-radius: var(--radius-md); border-left: none; border-right: none; }
    main { padding: 0; margin-top: 1rem; }
    .pdf-preview-wrapper { height: 350px; }
}