/**
 * style.css
 * 
 * CSS utama untuk Sistem Pengumuman Kelulusan
 * Design modern dan responsif dengan animasi
 */

:root {
  --primary-color: #0d6efd;
  --primary-dark: #0b5ed7;
  --secondary-color: #6c757d;
  --accent-color: #ffc107;
  --success-color: #198754;
  --danger-color: #dc3545;
  --dark-color: #212529;
  --light-color: #f8f9fa;
  --white-color: #ffffff;
  --gradient-primary: linear-gradient(45deg, #0d6efd, #0dcaf0);
  --gradient-secondary: linear-gradient(135deg, #6610f2, #0d6efd);
  --gradient-success: linear-gradient(45deg, #198754, #20c997);
  --box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  --box-shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.2);
  --transition: all 0.3s ease;
  --border-radius: 10px;
  --border-radius-lg: 15px;
  --font-family: 'Poppins', sans-serif;
}

/* ==== Base Styles ==== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background-color: #f5f8ff;
  color: var(--dark-color);
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
}

a {
  text-decoration: none;
  color: var(--primary-color);
  transition: var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

/* Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.98);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner-container {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(var(--primary-color), 0.2);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.loading-text {
    margin-top: 15px;
    color: var(--primary-color);
    font-weight: 500;
}

.dots {
    display: inline-block;
    width: 20px;
    text-align: left;
    animation: dots 1.5s infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* ==== Particles Background ==== */
#particles-js {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

/* ==== Header ==== */
header {
    background: var(--gradient-secondary);
    color: var(--white-color);
    padding: 1.5rem 0;
    box-shadow: var(--box-shadow);
}

.school-name {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
}

.logo-container {
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: var(--box-shadow);
}

.logo-img {
    max-width: 100%;
    max-height: 100%;
}

/* ==== Main Card ==== */
.main-card {
  border: none;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--box-shadow);
  transition: var(--transition);
  background-color: var(--white-color);
  margin-bottom: 2rem;
}

.main-card:hover {
  box-shadow: var(--box-shadow-hover);
  transform: translateY(-5px);
}

.main-card .card-header {
  background: var(--gradient-primary);
  padding: 1.2rem;
  border-bottom: none;
}

.main-card .card-body {
  padding: 2rem;
}

.main-card .card-footer {
  background-color: rgba(13, 110, 253, 0.05);
  border-top: none;
}

.welcome-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--white-color);
  font-size: 2rem;
  box-shadow: 0 5px 15px rgba(13, 110, 253, 0.4);
}

.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 600;
}

.btn-check {
  background: var(--gradient-primary);
  color: var(--white-color);
  font-weight: 500;
  padding: 12px 20px;
  border: none;
  border-radius: 50px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  z-index: 1;
}

.btn-check:before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--gradient-secondary);
  transition: var(--transition);
  z-index: -1;
}

.btn-check:hover {
  box-shadow: 0 5px 15px rgba(13, 110, 253, 0.4);
  color: var(--white-color);
}

.btn-check:hover:before {
  left: 0;
}

.input-group {
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
  border-radius: 50px;
  overflow: hidden;
}

.input-group-text {
  background-color: var(--white-color);
  border-right: none;
  color: var(--primary-color);
}

.input-nisn {
  border-left: none;
  padding-left: 0;
}

.form-control:focus {
  box-shadow: none;
  border-color: #ced4da;
}

/* ==== Information Section ==== */
.info-section {
  background-color: var(--light-color);
  position: relative;
}

.section-title {
  color: var(--dark-color);
  font-weight: 700;
  margin-bottom: 1rem;
  position: relative;
}

.divider {
  width: 80px;
  height: 4px;
  background: var(--gradient-primary);
  margin-bottom: 2rem;
  border-radius: 2px;
}

.info-card {
  background-color: var(--white-color);
  border-radius: var(--border-radius);
  padding: 2rem;
  text-align: center;
  box-shadow: var(--box-shadow);
  transition: var(--transition);
  height: 100%;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.info-card:after {
  content: "";
  position: absolute;
  bottom: -100%;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to top, rgba(13, 110, 253, 0.07), transparent);
  transition: var(--transition);
  z-index: -1;
}

.info-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--box-shadow-hover);
}

.info-card:hover:after {
  bottom: 0;
}

.info-icon {
  width: 70px;
  height: 70px;
  margin: 0 auto 1.5rem;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--white-color);
  font-size: 1.5rem;
  box-shadow: 0 5px 15px rgba(13, 110, 253, 0.3);
}

/* ==== Counter Section ==== */
.counter-section {
  background-color: #f8f9fa;
  position: relative;
  overflow: hidden;
}

.counter-box {
  text-align: center;
  padding: 2rem;
  border-radius: var(--border-radius);
  background-color: var(--white-color);
  box-shadow: var(--box-shadow);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.counter-box:after {
  content: "";
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, rgba(13, 110, 253, 0.07), transparent);
  transition: var(--transition);
  z-index: -1;
}

.counter-box:hover {
  transform: translateY(-10px);
  box-shadow: var(--box-shadow-hover);
}

.counter-box:hover:after {
  top: 0;
}

.counter {
  font-size: 3rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  position: relative;
  display: inline-block;
}

.counter:after {
  content: "%";
  font-size: 1.5rem;
  position: absolute;
  right: -20px;
  top: 5px;
}

.counter-box:nth-child(1) .counter:after {
  content: "";
}

.counter-box:nth-child(2) .counter:after {
  content: "";
}

/* ==== Footer ==== */
footer {
  background: var(--gradient-primary);
  position: relative;
  z-index: 1;
}

.social-icons a {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: var(--white-color);
  transition: var(--transition);
}

.social-icons a:hover {
  background-color: var(--white-color);
  color: var(--primary-color);
  transform: translateY(-5px);
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--primary-color);
    color: var(--white-color);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 1000;
    box-shadow: var(--box-shadow);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: var(--primary-dark);
    color: var(--white-color);
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-hover);
}

/* ==== Results Page Styles ==== */
.result-card {
  border: none;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--box-shadow);
  transition: var(--transition);
  background-color: var(--white-color);
}

.result-card:hover {
  box-shadow: var(--box-shadow-hover);
}

.result-header {
  background: var(--gradient-success);
  color: var(--white-color);
  padding: 1.5rem;
  text-align: center;
}

.result-header.failed {
  background: var(--gradient-secondary);
}

.result-body {
  padding: 2rem;
}

.student-info {
  border-bottom: 1px solid #eee;
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
}

.student-photo {
  width: 120px;
  height: 150px;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: var(--box-shadow);
  margin: 0 auto 1rem;
}

.student-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.status-badge {
  display: inline-block;
  padding: 8px 15px;
  border-radius: 50px;
  font-weight: 500;
  margin-bottom: 1rem;
}

.status-badge.success {
  background-color: rgba(25, 135, 84, 0.1);
  color: var(--success-color);
  border: 1px solid rgba(25, 135, 84, 0.2);
}

.status-badge.failed {
  background-color: rgba(220, 53, 69, 0.1);
  color: var(--danger-color);
  border: 1px solid rgba(220, 53, 69, 0.2);
}

.grade-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

.grade-table th, .grade-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.grade-table th {
  font-weight: 600;
  color: var(--primary-color);
}

.result-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
}

.btn-download {
  background-color: var(--primary-color);
  color: var(--white-color);
  padding: 10px 20px;
  border-radius: 50px;
  font-weight: 500;
  transition: var(--transition);
}

.btn-download:hover {
  background-color: var(--primary-dark);
  color: var(--white-color);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(13, 110, 253, 0.3);
}

/* ==== Alert Styles ==== */
.alert {
  border-radius: var(--border-radius);
  border: none;
  padding: 15px 20px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.alert-success {
  background-color: rgba(25, 135, 84, 0.1);
  color: var(--success-color);
  border-left: 4px solid var(--success-color);
}

.alert-danger {
  background-color: rgba(220, 53, 69, 0.1);
  color: var(--danger-color);
  border-left: 4px solid var(--danger-color);
}

.alert-warning {
  background-color: rgba(255, 193, 7, 0.1);
  color: #856404;
  border-left: 4px solid var(--accent-color);
}

/* ==== Responsive Styles ==== */
@media (max-width: 991.98px) {
  .school-name {
    font-size: 1.5rem;
  }
  
  .counter {
    font-size: 2.5rem;
  }
}

@media (max-width: 767.98px) {
  .logo-container {
    width: 100px;
    height: 100px;
  }
  
  .school-name {
    font-size: 1.3rem;
  }
  
  .main-card .card-body {
    padding: 1.5rem;
  }
  
  .welcome-icon {
    width: 70px;
    height: 70px;
    font-size: 1.5rem;
  }
  
  .counter {
    font-size: 2rem;
  }
  
  .info-icon {
    width: 60px;
    height: 60px;
    font-size: 1.3rem;
  }
}

@media (max-width: 575.98px) {
  header {
    padding: 15px 0;
  }
  
  .logo-container {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
  }
  
  .main-card .card-body {
    padding: 1.2rem;
  }
  
  .welcome-icon {
    width: 60px;
    height: 60px;
    font-size: 1.3rem;
  }
  
  .btn-check {
    padding: 10px 15px;
  }
  
  .info-card, .counter-box {
    padding: 1.5rem;
  }
  
  .info-icon {
    width: 50px;
    height: 50px;
    font-size: 1.1rem;
    margin-bottom: 1rem;
  }
  
  .counter {
    font-size: 1.8rem;
  }
  
  .back-to-top {
    width: 40px;
    height: 40px;
    right: 15px;
    font-size: 1rem;
  }
  
  .back-to-top.visible {
    bottom: 15px;
  }
}

/* ==== Animation Keyframes ==== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes float {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
  100% {
    transform: translateY(0);
  }
}

/* ==== Animations Classes ==== */
.animate-fade-in {
  animation: fadeIn 1s ease forwards;
}

.animate-pulse {
  animation: pulse 2s ease infinite;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

/* ==== Hasil Kelulusan Page ==== */
.certificate-border {
  border: 2px solid #e9ecef;
  border-radius: 10px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.certificate-border:before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path fill="none" stroke="rgba(13, 110, 253, 0.1)" stroke-width="2" d="M0,0 L100,100 M100,0 L0,100"/></svg>');
  background-size: 20px 20px;
  opacity: 0.2;
  pointer-events: none;
}

.congratulation-badge {
  position: absolute;
  top: -25px;
  right: -25px;
  width: 100px;
  height: 100px;
  background: var(--gradient-success);
  transform: rotate(45deg);
  z-index: 1;
}

.congratulation-badge i {
  position: absolute;
  bottom: 15px;
  left: 15px;
  color: var(--white-color);
  font-size: 20px;
  transform: rotate(-45deg);
}

.certificate-header {
  text-align: center;
  margin-bottom: 20px;
  position: relative;
}

.stamp {
  position: absolute;
  right: 20px;
  top: 20px;
  width: 100px;
  height: 100px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="45" fill="none" stroke="rgba(25, 135, 84, 0.5)" stroke-width="2"/><path d="M25,50 L40,65 L75,30" fill="none" stroke="rgba(25, 135, 84, 0.5)" stroke-width="3"/></svg>');
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.7;
  transform: rotate(-15deg);
}

.table-nilai {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

.table-nilai th, .table-nilai td {
  padding: 10px 15px;
  border: 1px solid #dee2e6;
}

.table-nilai th {
  background-color: rgba(13, 110, 253, 0.1);
  font-weight: 600;
}

.table-nilai tr:nth-child(even) {
  background-color: rgba(0, 0, 0, 0.02);
}

.nilai-rata {
  font-weight: 700;
  color: var(--primary-color);
}

.qr-code {
  width: 100px;
  height: 100px;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
}

.signature {
  margin-top: 2rem;
  text-align: center;
}

.signature img {
  max-height: 60px;
  margin-bottom: 10px;
}

.signature-line {
  width: 200px;
  height: 1px;
  background-color: #000;
  margin: 10px auto;
}

/* Loading Overlay for AJAX requests */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.8);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s, visibility 0.3s;
}

.loading-overlay.show {
  visibility: visible;
  opacity: 1;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 5px solid #f3f3f3;
  border-top: 5px solid var(--primary-color);
  animation: spin 1s linear infinite;
}

/* Print Styles */
@media print {
  header, footer, .back-to-top, .btn-back {
    display: none !important;
  }
  
  .certificate-border {
    border: 2px solid #000;
    box-shadow: none;
  }
  
  .container {
    width: 100%;
    max-width: 100%;
  }
  
  body {
    background-color: #fff;
  }
  
  .result-card {
    box-shadow: none;
  }
}