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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: rgb(251, 248, 248);
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* Welcome Overlay Styles */
.welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.welcome-overlay.hidden {
    display: none;
}

.welcome-form {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 90%;
    width: 400px;
}

.welcome-form h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 24px;
}

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

.form-group input {
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-group input:focus {
    border-color: #cf2dca;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group button {
    background: #681957;
    color: white;
    border: none;
    padding: 15px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-group button:hover {
    background: #b018a0;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    transition: opacity 0.3s ease;
}

.welcome-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.welcome-form {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 90%;
    width: 400px;
}

.welcome-form h2 {
    color: #333;
    margin-bottom: 30px;
}

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

.form-group input {
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-group input:focus {
    border-color: #be1fbb;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group button {
    background: #a21ea0;
    color: white;
    border: none;
    padding: 15px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-group button:hover {
    background: #cc17c0;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.top-nav {
    display: flex;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e5e9;
}

.nav-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #e1e5e9;
    color: #141414;
    text-decoration: none;
    margin-right: 15px;
}

.nav-btn.active {
    background: #da16d7;
    color: white;
    box-shadow: 0 5px 15px rgba(197, 45, 194, 0.3);
}

.nav-btn:hover {
    transform: translateY(-2px);
}

.user-info {
    margin-left: auto;
    display: flex;
    gap: 15px;
    align-items: center;
}

.student-info {
    font-size: 14px;
    color: #555;
    background: #fff;
    padding: 8px 15px;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
}

.container {
    width: 100%;
    margin: 0;
    background: white;
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #aa10d1 0%, #c70cc4 100%);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

h1 {
    color: rgb(252, 253, 252);
    font-size: 2.5rem;
    margin: 0;
}

.byline {
    display: inline-block;
    font-size: 0.5rem; /* very tiny text */
    color: rgba(255,255,255,0.9);
    font-weight: 400;
    margin-left: 8px;
    vertical-align: baseline;
    opacity: 0.95;
}

.profile-section {
    position: relative;
}

.profile-btn {
    background: transparent;
    border: 2px solid white;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
}

.profile-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.profile-icon {
    fill: white;
}

.profile-dropdown {
    position: absolute;
    top: 55px;
    right: 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    padding: 20px;
    min-width: 250px;
    display: none;
    z-index: 1000;
}

.profile-dropdown.active {
    display: block;
    animation: slideDown 0.3s ease;
}

.profile-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.profile-info h3 {
    color: #333;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #cf32c5;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1.2px solid #eee;
}

.info-item .label {
    font-weight: 600;
    color: #333;
}

.info-item .value {
    color: #c81cbc;
}

.editable-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.edit-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.edit-btn:hover {
    background: #f0f2ff;
}

.edit-btn svg {
    fill: #c115bb;
}

.editing .value {
    display: none;
}

.editing input {
    padding: 4px 8px;
    border: 2px solid #e62ae2;
    border-radius: 4px;
    font-size: 14px;
    width: 150px;
}

.editing input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.editing .edit-actions {
    display: flex;
    gap: 4px;
}

.editing .save-btn,
.editing .cancel-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.editing .save-btn {
    background: #b70d92;
    color: white;
}

.editing .cancel-btn {
    background: #e5e7eb;
    color: #333;
}

.logout-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: #c82333;
    transform: translateY(-2px);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.calculator {
    width: 100%;
    margin: 0;
    padding: 0;
}

.container-card {
    background: #f8f9fa;
    padding: 25px;
    width: 100%;
    margin: 0;
}

.input-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    width: 100%;
}

.results-container {
    margin-top: 20px;
    width: 100%;
}

h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5rem;
    text-align: center;
}

.subject-row, .semester-row {
    display: grid;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

.subject-row {
    grid-template-columns: 2fr 1.5fr 1fr auto;
}

.semester-row {
    grid-template-columns: 2fr 1fr auto;
}

.subject-row input, .semester-row input {
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.subject-name, .semester-name {
    min-width: 180px;
}

.credits, .semester-sgpa {
    min-width: 100px;
}

.subject-row input:focus, .semester-row input:focus {
    border-color: #cb18c2;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* CGPA Calculator specific styles */
#add-subject, #add-semester, 
#calculate-cgpa, #calculate-final-cgpa, 
#clear-all, #clear-all-semesters {
    background: #b607b3;
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    margin: 10px 5px;
    transition: all 0.3s ease;
    width: calc(100% - 10px);
}

#add-subject:hover, #add-semester:hover,
#calculate-cgpa:hover, #calculate-final-cgpa:hover {
    background: #c715b5;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

#clear-all, #clear-all-semesters {
    background: #e74c3c;
}

#clear-all:hover, #clear-all-semesters:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.3);
}

.remove-subject, .remove-semester {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 12px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.3s ease;
}

.remove-subject:hover, .remove-semester:hover {
    background: #c0392b;
}

.subject-name, .grade-select, .credits {
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.subject-name:focus, .grade-select:focus, .credits:focus {
    outline: none;
    border-color: #d61cbd;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.remove-subject {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 12px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.3s ease;
}

.remove-subject:hover {
    background: #c0392b;
}

#add-subject, #calculate-cgpa, #clear-all {
    background: #d510c8;
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    margin: 10px 5px;
    transition: all 0.3s ease;
}

#add-subject:hover, #calculate-cgpa:hover {
    background: #ac12d2;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

#clear-all {
    background: #e74c3c;
}

#clear-all:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.3);
}

.result-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.result-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.cgpa-result {
    font-size: 1.3rem;
    font-weight: bold;
    color: #d617d3;
    border: 2px solid #7d06a4;
    border-radius: 10px;
    padding: 15px;
}

.label {
    font-weight: 600;
    color: #555;
}

#cgpa-value {
    font-size: 2rem;
    color: #cb1cc8;
}

.grade-table {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.grade-table h3 {
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background: #67d51e;
    color: white;
    font-weight: 600;
    border-radius: 1px;
}

tr:hover {
    background: #f8f9fa;
}

/* Responsive Design */


/* User Details Styles */
.user-details {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
}

.user-details input {
    border-radius: 8px;
    border: 2px solid #e1e5e9;
    font-size: 14px;
}

.user-details .student-name {
    min-width: 180px;
}

.user-details .student-usn {
    min-width: 120px;
}
.student-name, .student-usn {
    padding: 12px;
    border-radius: 8px;
    border: 2px solid #e1e5e9;
    font-size: 14px;
    min-width: 120px;
}
.student-name {
    min-width: 180px;
}
@media (max-width: 768px) {
    .calculator {
        grid-template-columns: 1fr;
        display: flex;
        flex-direction: column;
    }
    
    .subject-row, .semester-row {
        grid-template-columns: 1fr;
        gap: 10px;
        display: flex;
        flex-direction: column;
    }
    
    h1 {
        font-size: 2rem;
        padding: 20px;
    }

    .byline {
        font-size: 0.6rem;
    }
    
    .container {
        margin: 10px auto;
        border-radius: 15px;
        box-shadow: none;
    }

    .input-section, .result-section {
        padding: 15px;
        width: 100%;
    }

    .result-card, .grade-table {
        padding: 10px;
        width: 100%;
        box-shadow: none;
    }

    /* Making all input fields and buttons consistent width */
    .subject-name, 
    .grade-select, 
    .credits,
    .semester-name,
    .semester-sgpa,
    .remove-subject,
    #add-subject, 
    #calculate-cgpa, 
    #clear-all,
    #add-semester,
    #calculate-final-cgpa,
    #clear-all-semesters,
    #download-marksheet,
    #download-cgpa-marksheet {
        width: 100% !important;
        margin: 5px 0 !important;
        padding: 12px !important;
        font-size: 1rem !important;
        height: auto !important;
        box-sizing: border-box !important;
    }

    /* Style adjustments for input fields */
    .subject-name,
    .grade-select,
    .credits,
    .semester-name,
    .semester-sgpa {
        border: 2px solid #e1e5e9;
        border-radius: 8px;
    }

    .subject-row > *,
    .semester-row > * {
        margin: 0;
        text-align: left;
    }

    /* Table styles */
    th, td {
        padding: 8px;
        font-size: 0.95rem;
    }

    table {
        font-size: 0.95rem;
        width: 100%;
    }

    .cgpa-result {
        font-size: 1.1rem;
        padding: 10px;
    }

    #cgpa-value {
        font-size: 1.3rem;
    }

    /* Messages */
    .success-message, .error-message {
        font-size: 0.95rem;
        padding: 10px;
        margin: 10px 0;
        width: 100%;
    }

    .grade-table h3 {
        font-size: 1.1rem;
    }

    #subjects-container,
    #semesters-container {
        width: 100%;
    }
}


@media (max-width: 480px) {
    .container {
        margin: 2px auto;
        border-radius: 8px;
        padding: 0;
    }

    h1 {
        font-size: 1.2rem;
        padding: 10px;
    }

    .input-section, .result-section {
        padding: 8px;
    }

    .result-card, .grade-table {
        padding: 5px;
    }

    /* Smaller font sizes for mobile */
    .subject-name, 
    .grade-select, 
    .credits,
    .semester-name,
    .semester-sgpa,
    .remove-subject,
    #add-subject, 
    #calculate-cgpa, 
    #clear-all,
    #add-semester,
    #calculate-final-cgpa,
    #clear-all-semesters,
    #download-marksheet,
    #download-cgpa-marksheet {
        font-size: 0.95rem !important;
        padding: 10px !important;
    }

    th, td {
        padding: 5px;
        font-size: 0.85rem;
    }

    .cgpa-result {
        font-size: 1rem;
        padding: 6px;
    }

    #cgpa-value {
        font-size: 1rem;
    }

    .success-message, .error-message {
        font-size: 0.85rem;
        padding: 6px;
        margin: 6px 0;
    }

    .grade-table h3 {
        font-size: 1rem;
    }
}

/* Calculator Navigation */
.calculator-nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background: #f8f9fa;
}

.nav-btn {
    background: #e1e5e9;
    color: #333;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.nav-btn.active {
    background: #bb18a8;
    color: white;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.nav-btn:hover {
    transform: translateY(-2px);
}

/* Download button styles */
#download-marksheet, #download-cgpa-marksheet {
    background: #28a745 !important;
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    margin: 10px 5px;
    width: calc(100% - 10px);
    transition: all 0.3s ease;
}

#download-marksheet:hover, #download-cgpa-marksheet:hover {
    background: #218838 !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

/* Animation for adding subjects and semesters */
.subject-row {
    animation: slideIn 0.3s ease-in;
}

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

/* Success message styling */
.success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #28a745;
}

/* Error message styling */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #dc3545;
}
