@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700&family=Great+Vibes&display=swap');

:root {
    --primary: #1a237e;
    --primary-light: #283593;
    --primary-dark: #0d1b4a;
    --secondary: #1565c0;
    --accent: #f5a623;
    --gold: #c9a84c;
    --white: #ffffff;
    --light-bg: #f0f4ff;
    --light-gray: #f8f9fa;
    --text-dark: #1a1a2e;
    --text-gray: #6c757d;
    --border-color: #e0e7ff;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-lg: 20px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--light-bg);
    color: var(--text-dark);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary), var(--primary-light));
    color: var(--white);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0,0,0,0.2);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-area img {
    height: 65px;
    width: auto;
    filter: brightness(0) invert(1);
}

.logo-text h1 {
    font-family: 'Playfair Display', serif;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 1px;
}

.logo-text .tagline {
    font-size: 12px;
    opacity: 0.85;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.header-contact {
    display: flex;
    gap: 20px;
    font-size: 13px;
    opacity: 0.9;
}

.header-contact span { display: flex; align-items: center; gap: 5px; }

/* Main Form */
.main-wrapper {
    padding: 40px 0;
}

.form-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.form-card-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    padding: 30px 40px;
}

.form-card-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    font-weight: 600;
}

.form-card-header p { opacity: 0.85; font-size: 14px; margin-top: 5px; }

.form-card-body { padding: 40px; }

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

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-dark);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group label .required { color: #dc3545; }

.form-control {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
    background: var(--light-gray);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,35,126,0.1);
    background: var(--white);
}

.form-control[readonly] {
    background: #e9ecef;
    cursor: not-allowed;
}

.form-group textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* Photo Upload */
.photo-upload-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.photo-preview {
    width: 150px;
    height: 180px;
    border: 3px dashed var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--light-gray);
}

.photo-preview:hover {
    border-color: var(--primary);
    background: #e8eaf6;
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview .placeholder {
    text-align: center;
    color: var(--text-gray);
    font-size: 12px;
}

.photo-preview .placeholder i {
    font-size: 36px;
    display: block;
    margin-bottom: 5px;
    color: var(--primary);
}

/* Buttons */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    box-shadow: 0 4px 15px rgba(26,35,126,0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26,35,126,0.4);
}

.btn-success {
    background: linear-gradient(135deg, #2e7d32, #43a047);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(46,125,50,0.3);
}

.btn-info {
    background: linear-gradient(135deg, #1565c0, #1976d2);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(21,101,192,0.3);
}

.btn-warning {
    background: linear-gradient(135deg, #f57f17, #f9a825);
    color: var(--white);
}

.btn-danger {
    background: linear-gradient(135deg, #c62828, #e53935);
    color: var(--white);
}

.btn-secondary {
    background: linear-gradient(135deg, #455a64, #607d8b);
    color: var(--white);
}

.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-lg { padding: 14px 36px; font-size: 16px; }

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

.form-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e2e8f0;
}

/* Certificate Preview */
.certificate-preview-wrapper {
    display: none;
    margin-top: 40px;
}

.certificate-preview-wrapper.show {
    display: block;
    animation: fadeInUp 0.5s ease;
}

.certificate-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 25px;
    justify-content: center;
}

/* Certificate Design */
.certificate-container {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    background: var(--white);
    padding: 20mm 15mm;
    position: relative;
    box-shadow: var(--shadow-lg);
    font-family: 'Inter', sans-serif;
}

.certificate-border {
    position: absolute;
    top: 8mm;
    left: 8mm;
    right: 8mm;
    bottom: 8mm;
    border: 3px solid var(--gold);
    border-radius: 5mm;
    pointer-events: none;
}

.certificate-border-inner {
    position: absolute;
    top: 11mm;
    left: 11mm;
    right: 11mm;
    bottom: 11mm;
    border: 1.5px solid var(--gold);
    border-radius: 4mm;
    pointer-events: none;
}

.certificate-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-30deg);
    font-size: 48px;
    color: rgba(26,35,126,0.04);
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
    letter-spacing: 8px;
}

.certificate-header {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.certificate-header .logo {
    height: 70px;
    margin-bottom: 8px;
}

.certificate-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    color: var(--primary);
    font-weight: 700;
    letter-spacing: 1px;
}

.certificate-header .tagline {
    font-size: 12px;
    color: var(--text-gray);
    letter-spacing: 3px;
    text-transform: uppercase;
}

.certificate-header .contact-info {
    font-size: 10px;
    color: var(--text-gray);
    margin-top: 3px;
}

.certificate-title {
    text-align: center;
    margin: 25px 0;
    position: relative;
    z-index: 1;
}

.certificate-title h2 {
    font-family: 'Playfair Display', serif;
    font-size: 22px;
    color: var(--primary);
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    border-bottom: 2px solid var(--gold);
    display: inline-block;
    padding-bottom: 8px;
}

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

.certificate-content {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.employee-details {
    flex: 1;
}

.employee-details p {
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-dark);
}

.employee-details .label {
    font-weight: 600;
    color: var(--primary);
}

.employee-photo-area {
    flex-shrink: 0;
    width: 130px;
    text-align: center;
}

.employee-photo-area img {
    width: 120px;
    height: 145px;
    object-fit: cover;
    border-radius: 10px;
    border: 3px solid var(--gold);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.certificate-text {
    position: relative;
    z-index: 1;
    padding: 10px 0;
}

.certificate-text p {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-dark);
    text-align: justify;
}

.certificate-text .highlight {
    font-weight: 600;
    color: var(--primary);
}

.certificate-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 30px;
    position: relative;
    z-index: 1;
}

.footer-logos {
    display: flex;
    gap: 20px;
    align-items: center;
}

.footer-logos img {
    height: 40px;
    width: auto;
    opacity: 0.8;
}

.signature-area {
    text-align: center;
}

.signature-area .signature-line {
    width: 180px;
    border-top: 2px solid var(--text-dark);
    margin: 5px auto 0;
}

.signature-area .signature-img {
    max-height: 50px;
    margin-bottom: 5px;
}

.signature-area p {
    font-size: 12px;
    color: var(--text-dark);
    font-weight: 600;
}

.signature-area .designation {
    font-weight: 400;
    font-size: 11px;
    color: var(--text-gray);
}

.certificate-number {
    position: absolute;
    bottom: 15mm;
    left: 15mm;
    font-size: 9px;
    color: var(--text-gray);
    z-index: 1;
}

.qr-code {
    position: absolute;
    bottom: 15mm;
    right: 15mm;
    z-index: 1;
}

.qr-code img {
    width: 50px;
    height: 50px;
}

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

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.alert-danger { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }
.alert-info { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }

/* Print Styles */
@media print {
    body { background: white; }
    .site-header, .form-card, .certificate-actions, .form-actions { display: none !important; }
    .certificate-preview-wrapper { display: block !important; margin: 0; }
    .certificate-preview-wrapper.show { display: block !important; }
    .certificate-container {
        box-shadow: none;
        padding: 15mm 12mm;
        width: 100%;
        min-height: auto;
    }
    .certificate-border { top: 5mm; left: 5mm; right: 5mm; bottom: 5mm; }
    .certificate-border-inner { top: 8mm; left: 8mm; right: 8mm; bottom: 8mm; }
    @page { size: A4 portrait; margin: 0; }
}

/* Responsive */
@media (max-width: 768px) {
    .header-inner { flex-direction: column; text-align: center; }
    .logo-area { flex-direction: column; }
    .header-contact { flex-direction: column; gap: 5px; }
    .form-card-header { padding: 20px; }
    .form-card-body { padding: 20px; }
    .form-row { grid-template-columns: 1fr; }
    .certificate-container { width: 100%; padding: 15mm 10mm; }
    .certificate-content { flex-direction: column-reverse; align-items: center; }
    .certificate-footer { flex-direction: column; align-items: center; gap: 20px; }
    .footer-logos { flex-wrap: wrap; justify-content: center; }
    .certificate-header .logo { height: 50px; }
    .certificate-header h1 { font-size: 22px; }
    .logo-text h1 { font-size: 20px; }
}
