@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

* {
   margin: 0;
   padding: 0;
   box-sizing: border-box;
}

:root {
   --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
   --secondary-gradient: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
   --accent-gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
   --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
   --glass-bg: rgba(255, 255, 255, 0.95);
   --glass-border: rgba(255, 255, 255, 0.8);
   --text-primary: #1f2937;
   --text-secondary: #6b7280;
   --shadow-light: 0 10px 25px rgba(0, 0, 0, 0.1);
   --shadow-heavy: 0 20px 40px rgba(0, 0, 0, 0.15);
   --card-bg: rgba(255, 255, 255, 0.98);
}

body {
   font-family: 'Poppins', sans-serif;
   background: linear-gradient(135deg, #fef3c7 0%, #fce7f3 25%, #e0e7ff 50%, #dbeafe 75%, #f0f9ff 100%);
   background-attachment: fixed;
   min-height: 100vh;
   padding: 20px;
   position: relative;
   overflow-x: hidden;
}

body::before {
   content: '';
   position: fixed;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   background:
      radial-gradient(circle at 20% 50%, rgba(251, 191, 36, 0.15) 0%, transparent 50%),
      radial-gradient(circle at 80% 20%, rgba(236, 72, 153, 0.15) 0%, transparent 50%),
      radial-gradient(circle at 40% 80%, rgba(59, 130, 246, 0.15) 0%, transparent 50%);
   pointer-events: none;
   z-index: -1;
}

.floating-shapes {
   position: fixed;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   pointer-events: none;
   z-index: -1;
}

.shape {
   position: absolute;
   border-radius: 50%;
   background: rgba(59, 130, 246, 0.1);
   animation: float 6s ease-in-out infinite;
}

.shape:nth-child(1) {
   width: 80px;
   height: 80px;
   top: 10%;
   left: 10%;
   animation-delay: 0s;
}

.shape:nth-child(2) {
   width: 120px;
   height: 120px;
   top: 70%;
   right: 10%;
   animation-delay: 2s;
}

.shape:nth-child(3) {
   width: 60px;
   height: 60px;
   top: 40%;
   left: 80%;
   animation-delay: 4s;
}

@keyframes float {

   0%,
   100% {
      transform: translateY(0px) rotate(0deg);
   }

   50% {
      transform: translateY(-20px) rotate(180deg);
   }
}

.container {
   max-width: 1000px;
   margin: 0 auto;
   backdrop-filter: blur(20px);
   background: var(--card-bg);
   border: 2px solid white;
   border-radius: 25px;
   padding: 40px;
   box-shadow: var(--shadow-heavy);
   position: relative;
   z-index: 1;
}

.header {
   text-align: center;
   margin-bottom: 40px;
   position: relative;
}

.header h1 {
   font-size: 3rem;
   font-weight: 800;
   background: var(--primary-gradient);
   -webkit-background-clip: text;
   -webkit-text-fill-color: transparent;
   background-clip: text;
   margin-bottom: 10px;
   text-shadow: 0 4px 20px rgba(79, 70, 229, 0.2);
}

.header p {
   color: var(--text-secondary);
   font-size: 1.1rem;
   font-weight: 400;
}

/* Logo Styling */
.logo-container {
   display: flex;
   justify-content: center;
   align-items: center;
   margin-bottom: 20px;
   /* Space between logo and title */
}

.logo-container svg {
   width: 100px;
   /* Adjust size as needed */
   height: 100px;
}


.controls-grid {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
   gap: 25px;
   margin-bottom: 30px;
}

.control-group {
   position: relative;
}

.control-group label {
   display: block;
   color: var(--text-primary);
   font-weight: 600;
   margin-bottom: 10px;
   font-size: 0.95rem;
   text-transform: uppercase;
   letter-spacing: 0.5px;
}

.input-wrapper {
   position: relative;
}

.input-wrapper input {
   width: 100%;
   padding: 18px 20px;
   background: white;
   border: 2px solid #e5e7eb;
   border-radius: 15px;
   color: var(--text-primary);
   font-size: 1rem;
   font-weight: 500;
   transition: all 0.3s ease;
   backdrop-filter: blur(10px);
}

.input-wrapper input:focus {
   outline: none;
   border-color: #4f46e5;
   background: white;
   box-shadow: 0 0 25px rgba(79, 70, 229, 0.15);
   transform: translateY(-2px);
}

.input-wrapper input::placeholder {
   color: #9ca3af;
}

.checkbox-container {
   display: flex;
   align-items: center;
   margin: 25px 0;
   padding: 20px;
   background: white;
   border-radius: 15px;
   border: 2px solid #f3f4f6;
   transition: all 0.3s ease;
   box-shadow: var(--shadow-light);
}

.checkbox-container:hover {
   background: #fafafa;
   transform: translateY(-2px);
   box-shadow: var(--shadow-heavy);
}

.custom-checkbox {
   position: relative;
   margin-right: 35px;
}

.custom-checkbox input {
   opacity: 0;
   width: 0;
   height: 0;
}

.checkmark {
   position: absolute;
   top: 0;
   left: 0;
   height: 24px;
   width: 24px;
   background: white;
   border-radius: 6px;
   border: 2px solid #d1d5db;
   transition: all 0.3s ease;
   cursor: pointer;
}

.custom-checkbox input:checked~.checkmark {
   background: var(--accent-gradient);
   border-color: transparent;
   box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
}

.checkmark:after {
   content: "";
   position: absolute;
   display: none;
}

.custom-checkbox input:checked~.checkmark:after {
   display: block;
}

.custom-checkbox .checkmark:after {
   left: 7px;
   top: 3px;
   width: 6px;
   height: 12px;
   border: solid white;
   border-width: 0 2px 2px 0;
   transform: rotate(45deg);
}

.checkbox-container label {
   /* Existing styles */
   color: var(--text-primary);
   font-weight: 500;
   cursor: pointer;
   user-select: none;
   display: flex;
   /* Makes the label a flex container */
   align-items: center;
   /* Vertically aligns items within the label */
}

.button-group {
   display: flex;
   gap: 20px;
   justify-content: center;
   margin: 30px 0;
   flex-wrap: wrap;
}

.btn {
   padding: 15px 30px;
   border: none;
   border-radius: 50px;
   font-weight: 600;
   font-size: 1rem;
   cursor: pointer;
   transition: all 0.3s ease;
   text-transform: uppercase;
   letter-spacing: 0.5px;
   position: relative;
   overflow: hidden;
   width: auto;
}

.btn-primary {
   background: var(--primary-gradient);
   color: white;
   box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
   background: var(--secondary-gradient);
   color: white;
   box-shadow: 0 8px 25px rgba(240, 147, 251, 0.4);
}

.btn:hover {
   transform: translateY(-3px);
   box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

.btn:active {
   transform: translateY(-1px);
}

.btn::before {
   content: '';
   position: absolute;
   top: 0;
   left: -100%;
   width: 100%;
   height: 100%;
   background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
   transition: left 0.5s;
}

.btn:hover::before {
   left: 100%;
}

.btn-pass-preset {
   padding: 4px 10px;
   font-size: 0.95rem;
   border-radius: 8px;
   background: var(--accent-gradient, #06b6d4);
   color: #fff;
   border: none;
   cursor: pointer;
   transition: background 0.2s;
   margin-bottom: 4px;
   width: auto;
   min-width: unset;
   max-width: 100%;
   white-space: nowrap;
}

.btn-pass-preset:hover {
   background: var(--primary-gradient, #4f46e5);
}

.btn-small {
   font-size: 0.95rem;
   padding: 6px 14px;
}

.pass-preset-row {
   margin-top: 8px;
   display: flex;
   gap: 8px;
   flex-wrap: nowrap;
   justify-content: flex-start;
}

@media (max-width: 600px) {
   .pass-preset-row {
      flex-wrap: wrap;
      justify-content: center;
   }
}

.summary-card {
   background: white;
   backdrop-filter: blur(15px);
   border: 2px solid #f3f4f6;
   border-radius: 20px;
   padding: 25px;
   margin: 30px 0;
   box-shadow: var(--shadow-light);
   transition: all 0.3s ease;
}

.summary-card:hover {
   transform: translateY(-5px);
   box-shadow: var(--shadow-heavy);
}

.summary-card h3 {
   color: var(--text-primary);
   font-size: 1.3rem;
   font-weight: 700;
   margin-bottom: 15px;
   text-align: center;
}

.summary-stats {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
   gap: 20px;
}

.stat-item {
   display: flex;
   flex-direction: column;
   align-items: flex-start;
   margin-bottom: 12px;
}

.stat-label {
   font-size: 1em;
   color: #6b7280;
   margin-bottom: 2px;
}

.stat-value {
   font-size: 1.25em;
   font-weight: 600;
   color: #1f2937;
   margin-top: 0;
}

.table-container {
   margin-top: 40px;
   border-radius: 20px;
   overflow: hidden;
   backdrop-filter: blur(15px);
   background: white;
   border: 2px solid #f3f4f6;
   box-shadow: var(--shadow-light);
}

.table-header {
   padding: 25px;
   background: #f8fafc;
   border-bottom: 2px solid #f1f5f9;
}

.table-header h2 {
   color: var(--text-primary);
   font-size: 1.5rem;
   font-weight: 700;
   text-align: center;
   margin: 0;
}

.table-wrapper {
   max-height: 500px;
   overflow-y: auto;
   /* Explicitly set scrollbar styles for different browsers */
   scrollbar-width: thin;
   /* Firefox */
   scrollbar-color: #6b7280 transparent;
   /* Firefox: thumb color track color */
}

/* Webkit (Chrome, Safari) scrollbar styles */
.table-wrapper::-webkit-scrollbar {
   width: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
   background: transparent;
   /* Light track */
}

.table-wrapper::-webkit-scrollbar-thumb {
   background: #6b7280;
   /* Darker grey thumb */
   border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
   background: #4b5563;
   /* Even darker on hover */
}

table {
   width: 100%;
   border-collapse: collapse;
}

thead {
   position: sticky;
   top: 0;
   background: #f8fafc;
   backdrop-filter: blur(10px);
   z-index: 10;
}

th {
   padding: 20px 15px;
   color: var(--text-primary);
   font-weight: 700;
   text-align: center;
   font-size: 0.95rem;
   text-transform: uppercase;
   letter-spacing: 0.5px;
   border-bottom: 2px solid #e5e7eb;
}

td {
   padding: 15px;
   text-align: center;
   color: var(--text-secondary);
   font-weight: 500;
   border-bottom: 1px solid #f3f4f6;
   transition: all 0.3s ease;
}

tbody tr:hover {
   background: #f8fafc;
   transform: scale(1.01);
}

.passing-grade-row {
   background: var(--success-gradient) !important;
   color: white !important;
   font-weight: 700 !important;
   box-shadow: 0 4px 15px rgba(67, 233, 123, 0.3);
}

.passing-grade-row td {
   color: white !important;
   border-bottom-color: rgba(255, 255, 255, 0.3);
}

.error-message {
   background: rgba(239, 68, 68, 0.1);
   color: #dc2626;
   padding: 10px 15px;
   border-radius: 10px;
   margin-top: 8px;
   font-size: 0.9rem;
   font-weight: 500;
   border: 1px solid rgba(239, 68, 68, 0.2);
   backdrop-filter: blur(10px);
}

.hidden {
   display: none !important;
}

/* Tooltip Styling */
.tooltip {
   position: relative;
   display: inline-block;
   cursor: pointer;
   color: #4f46e5;
   font-size: 1.1em;
   margin-left: 6px;
   vertical-align: middle;
}

.tooltip .tooltiptext {
   visibility: hidden;
   opacity: 0;
   width: 260px;
   background-color: #1f2937;
   color: #fff;
   text-align: left;
   border-radius: 8px;
   padding: 10px 14px;
   position: absolute;
   z-index: 10;
   bottom: 125%;
   left: 50%;
   transform: translateX(-50%);
   transition: opacity 0.2s;
   font-size: 0.95em;
   box-shadow: 0 4px 16px rgba(0, 0, 0, 0.13);
}

.tooltip:hover .tooltiptext,
.tooltip:focus .tooltiptext {
   visibility: visible;
   opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
   .container {
      padding: 25px;
      margin: 10px;
   }

   .header h1 {
      font-size: 7vw;
      min-font-size: 1.5rem;
      max-width: 100%;
      word-break: break-word;
      overflow-wrap: break-word;
   }

   .controls-grid {
      grid-template-columns: 1fr;
      gap: 20px;
   }

   .button-group {
      flex-direction: column;
      align-items: center;
   }

   .btn {
      width: 100%;
      max-width: 300px;
   }

   .summary-stats {
      grid-template-columns: 1fr;
   }
}

/* Loading Animation */
@keyframes pulse {
   0% {
      opacity: 1;
   }

   50% {
      opacity: 0.5;
   }

   100% {
      opacity: 1;
   }
}

.loading {
   animation: pulse 1.5s ease-in-out infinite;
}

footer {
   text-align: center;
   margin-top: 40px;
   padding: 20px;
   color: var(--text-secondary);
   font-size: 0.9rem;
   background: rgba(255, 255, 255, 0.7);
   border-radius: 15px;
   box-shadow: var(--shadow-light);
   backdrop-filter: blur(10px);
}

footer p {
   margin-bottom: 5px;
}

footer a {
   color: #4f46e5;
   /* Primary color */
   text-decoration: none;
   font-weight: 600;
   transition: color 0.3s ease;
}

footer a:hover {
   color: #7c3aed;
   /* Darker shade on hover */
}

#gradeGraphContainer {
   display: flex;
   flex-direction: column;
   align-items: center;
   width: 100%;
   max-width: 100vw;
   box-sizing: border-box;
}

#gradeGraphCanvas {
   display: block;
   margin: 0 auto;
   width: 100%;
   max-width: 700px;
   height: auto;
}

#passPercentageType {
   font-size: 1.1rem;
   padding: 10px 16px;
   border-radius: 8px;
   border: 1px solid #d1d5db;
   background: #f9fafb;
   color: #1f2937;
   outline: none;
   transition: border-color 0.2s, box-shadow 0.2s;
   box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
   height: 44px;
}

#passPercentageType:focus {
   border-color: #6366f1;
   box-shadow: 0 0 0 2px #6366f133;
}

.converter-grid {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
   gap: 20px;
   margin-top: 10px;
   margin-bottom: 10px;
}

.converter-group {
   display: flex;
   flex-direction: column;
   align-items: flex-start;
}

.converter-group label {
   font-weight: 600;
   margin-bottom: 6px;
   color: var(--text-primary);
}

.converter-group input[type="number"],
.converter-group input[readonly] {
   width: 100%;
   padding: 12px 16px;
   border: 2px solid #e5e7eb;
   border-radius: 10px;
   font-size: 1rem;
   font-family: inherit;
   margin-bottom: 0;
   background: #fff;
   color: var(--text-primary);
   box-sizing: border-box;
}

.converter-group input[readonly] {
   background: #f3f4f6;
   color: #6b7280;
   cursor: not-allowed;
}