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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.5;
    color: #2c3e50;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #7e8ba3 100%);
    padding: 20px;
    position: relative;
    text-align: justify;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 50px, rgba(255,255,255,0.03) 50px, rgba(255,255,255,0.03) 51px),
        repeating-linear-gradient(90deg, transparent, transparent 50px, rgba(255,255,255,0.03) 50px, rgba(255,255,255,0.03) 51px);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 210mm;
    margin: 0 auto;
    background-color: white;
    padding: 20mm 20mm;
    box-shadow: 0 10px 50px rgba(0,0,0,0.3);
    min-height: 297mm;
    position: relative;
    z-index: 1;
    border-radius: 20px 20px 20px 20px;
}

header {
    background: #2a5298;
    color: white;
    padding: 25px 20px;
    margin: -20mm -20mm 20px -20mm;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-radius: 20px 20px 0 0;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(45deg, transparent, transparent 20px, rgba(255,255,255,0.05) 20px, rgba(255,255,255,0.05) 40px);
    pointer-events: none;
}

header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #00d2ff 0%, #3a7bd5 50%, #00d2ff 100%);
}

h1 {
    color: white;
    font-size: 1.9em;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 3px;
    position: relative;
    z-index: 1;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.contact-info {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.9em;
    position: relative;
    z-index: 1;
}

.contact-info span {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.15);
    padding: 6px 14px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

h2 {
    color: #1e3c72;
    font-size: 1.3em;
    margin-top: 18px;
    margin-bottom: 10px;
    padding: 8px 0 8px 15px;
    border-left: 5px solid #2a5298;
    background: linear-gradient(90deg, rgba(42,82,152,0.1) 0%, rgba(255,255,255,0) 100%);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
    page-break-after: avoid;
    position: relative;
}
      
h3 {
    color: #1e3c72;
    font-size: 1.1em;
    margin-top: 12px;
    margin-bottom: 4px;
    font-weight: 700;
    page-break-after: avoid;
}

h4 {
    color: #2a5298;
    font-size: 1em;
    margin-top: 10px;
    margin-bottom: 6px;
    font-weight: 700;
    page-break-after: avoid;
    display: flex;
    align-items: center;
    gap: 8px;
}

section {
    page-break-inside: avoid;
}

.job-header {
    margin-bottom: 15px;
    page-break-inside: avoid;
}

.company {
    font-weight: 700;
    color: #2a5298;
    font-size: 1.05em;
}

.date {
    font-style: italic;
    color: #7f8c8d;
    font-size: 0.9em;
    display: block;
    margin-top: 4px;
    margin-bottom: 4px;
}

.summary {
    background: linear-gradient(135deg, rgba(30,60,114,0.05) 0%, rgba(42,82,152,0.08) 100%);
    padding: 15px 18px;
    border-left: 5px solid #2a5298;
    border-radius: 0 8px 8px 0;
    margin-bottom: 15px;
    font-size: 0.95em;
    line-height: 1.6;
    page-break-inside: avoid;
    box-shadow: 0 2px 8px rgba(42,82,152,0.1);
}

ul {
    margin-left: 20px;
    margin-bottom: 10px;
}

li {
    margin-bottom: 5px;
    line-height: 1.5;
    font-size: 0.95em;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.skill-category {
    background: linear-gradient(135deg, rgba(30,60,114,0.08) 0%, rgba(42,82,152,0.05) 100%);
    padding: 12px 14px;
    border-radius: 8px;
    border: 2px solid rgba(42,82,152,0.2);
    border-left: 4px solid #2a5298;
    page-break-inside: avoid;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.skill-category::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #00d2ff 0%, #2a5298 100%);
}

.skill-category h4 {
    margin-top: 0;
    color: #1e3c72;
}

.skill-category ul {
    margin-left: 0;
    list-style: none;
}

.skill-category li {
    padding-left: 20px;
    position: relative;
}

.skill-category li:before {
    content: "▸";
    position: absolute;
    left: 0;
    color: #00d2ff;
    font-weight: bold;
}

.education-item {
    margin-bottom: 12px;
    page-break-inside: avoid;
}

.degree {
    font-weight: 700;
    color: #1e3c72;
}

.institution {
    color: #555;
    font-size: 0.95em;
}

.cgpa {
    color: #00d2ff;
    font-weight: 700;
    background: rgba(0,210,255,0.1);
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
}

.references {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.reference-card {
    background: linear-gradient(135deg, rgba(30,60,114,0.08) 0%, rgba(42,82,152,0.05) 100%);
    padding: 18px 20px;
    border-radius: 12px;
    border: 2px solid rgba(42,82,152,0.2);
    border-left: 5px solid #2a5298;
    page-break-inside: avoid;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(42,82,152,0.1);
}

.reference-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #00d2ff 0%, #2a5298 100%);
}

.reference-card h4 {
    margin-top: 0;
    margin-bottom: 8px;
    color: #1e3c72;
    font-size: 1.1em;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(42,82,152,0.15);
}

.reference-card p {
    margin: 6px 0;
    font-size: 0.88em;
    color: #555;
    line-height: 1.6;
}

.reference-card p strong {
    color: #2a5298;
    font-weight: 600;
    display: inline-block;
    min-width: 50px;
}

@media print {
    @page {
        size: A4;
        margin: 15mm;
    }
    
    body {
        background: white !important;
        padding: 0;
        margin: 0;
    }
    
    body::before {
        display: none;
    }
    
    .container {
        max-width: 100%;
        box-shadow: none;
        padding: 0;
        margin: 0;
        min-height: auto;
    }
    
    header {
        margin: 0 0 15px 0;
        padding: 20px 15px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    h1 {
        font-size: 1.7em;
    }
    
    h2 {
        font-size: 1.2em;
        margin-top: 14px;
        margin-bottom: 8px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    h3 {
        font-size: 1.05em;
    }
    
    h4::before {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .summary {
        padding: 12px;
        font-size: 0.9em;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .job-header {
        page-break-inside: avoid;
    }
    
    .skills-grid {
        gap: 10px;
    }
    
    .skill-category {
        padding: 8px 10px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .reference-card {
        padding: 8px 10px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    ul {
        margin-bottom: 8px;
    }
    
    li {
        font-size: 0.9em;
        margin-bottom: 4px;
    }
}

.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #2a5298, #1e3c72);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(42,82,152,0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(42,82,152,0.4);
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 15px;
        border-radius: 10px;
    }
    
    header {
        margin: -15px -15px 15px -15px;
        padding: 20px 15px;
        border-radius: 10px 10px 0 0;
    }
    
    h1 {
        font-size: 1.5em;
        letter-spacing: 1px;
    }
    
    .contact-info {
        flex-direction: column;
        gap: 8px;
    }
    
    .contact-info span {
        padding: 8px 12px;
        font-size: 0.85em;
    }
}
