@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Poppins", sans-serif;
    text-decoration: none;
    list-style: none;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 10px;
    overflow-x: hidden;
}

/* Animated background particles */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
            circle at 20% 80%,
            rgba(120, 119, 198, 0.3) 0%,
            transparent 50%
        ),
        radial-gradient(
            circle at 80% 20%,
            rgba(255, 255, 255, 0.1) 0%,
            transparent 50%
        ),
        radial-gradient(
            circle at 40% 40%,
            rgba(120, 119, 198, 0.2) 0%,
            transparent 50%
        );
    animation: float 20s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes float {
    0%,
    100% {
        transform: translateY(0px) rotate(0deg);
    }
    33% {
        transform: translateY(-20px) rotate(1deg);
    }
    66% {
        transform: translateY(-10px) rotate(-1deg);
    }
}

.container {
    position: relative;
    width: 100%;
    max-width: 900px;
    min-height: 650px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.2);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: containerEntry 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    opacity: 0;
    transform: translateY(30px) scale(0.95);
}

@keyframes containerEntry {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.container h1 {
    font-size: clamp(24px, 5vw, 28px);
    margin: 0 0 8px 0;
    color: #1e293b;
    font-weight: 600;
    opacity: 0;
    animation: fadeInUp 0.6s ease-out 0.3s forwards;
}

.container p {
    font-size: 14px;
    margin: 0 0 24px 0;
    color: #64748b;
    opacity: 0;
    animation: fadeInUp 0.6s ease-out 0.4s forwards;
}

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

form {
    width: 100%;
}

/* Enhanced Form Box Animation */
.form-box {
    position: absolute;
    right: 0;
    width: 50%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: #1e293b;
    text-align: center;
    padding: 40px;
    z-index: 1;
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow-y: auto;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.container.active .form-box {
    right: 50%;
    transform: translateX(0);
}

.form-box.register {
    visibility: hidden;
    opacity: 0;
    transform: translateX(30px);
}

.container.active .form-box.register {
    visibility: visible;
    opacity: 1;
    transform: translateX(0);
}

.form-box.login {
    transform: translateX(0);
}

.container.active .form-box.login {
    transform: translateX(-30px);
}

/* Enhanced Input Animations */
.input-box {
    position: relative;
    margin: 12px 0;
    opacity: 0;
    animation: slideInRight 0.6s ease-out forwards;
}

.input-box:nth-of-type(1) {
    animation-delay: 0.1s;
}
.input-box:nth-of-type(2) {
    animation-delay: 0.2s;
}
.input-box:nth-of-type(3) {
    animation-delay: 0.3s;
}
.input-box:nth-of-type(4) {
    animation-delay: 0.4s;
}
.input-box:nth-of-type(5) {
    animation-delay: 0.5s;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.input-box input {
    width: 100%;
    padding: 16px 50px 16px 20px;
    background: rgba(248, 250, 252, 0.8);
    border: 2px solid rgba(226, 232, 240, 0.5);
    border-radius: 12px;
    outline: none;
    font-size: 14px;
    color: #1e293b;
    font-weight: 400;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    backdrop-filter: blur(10px);
}

.input-box input:focus {
    border-color: #3b82f6;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1),
        0 4px 20px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.input-box input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.input-box i {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s ease;
}

.input-box i:hover {
    color: #3b82f6;
    transform: translateY(-50%) scale(1.1);
}

.password-toggle {
    cursor: pointer;
    user-select: none;
}

.forgot-link {
    margin: 8px 0 20px;
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    opacity: 1 !important;
    animation: none !important;
    visibility: visible !important;
}

.forgot-link label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: #1e293b;
    cursor: pointer;
}

.forgot-link a {
    font-size: 13px;
    color: #3b82f6;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    font-weight: 500;
}

.forgot-link a::after {
    content: "";
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background: #3b82f6;
    transition: width 0.3s ease;
}

.forgot-link a:hover {
    color: #1d4ed8;
}

.forgot-link a:hover::after {
    width: 100%;
}

/* Enhanced Button Animations */
.btn {
    width: 100%;
    height: 50px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-size: 15px;
    color: #ffffff;
    font-weight: 600;
    margin: 12px 0;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    opacity: 0;
    animation: slideInUp 0.6s ease-out 0.7s forwards;
}

.btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.btn:active {
    transform: translateY(-1px);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.btn-secondary:hover {
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

/* Enhanced Toggle Box Animation */
.toggle-box {
    position: absolute;
    width: 100%;
    height: 100%;
}

.toggle-box::before {
    content: "";
    position: absolute;
    left: -250%;
    width: 300%;
    height: 100%;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-radius: 150px;
    z-index: 2;
    transition: all 2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 0 50px rgba(30, 41, 59, 0.3);
}

.container.active .toggle-box::before {
    left: 50%;
}

/* Enhanced Toggle Panel Animation */
.toggle-panel {
    position: absolute;
    width: 50%;
    height: 100%;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2;
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    padding: 40px;
}

.toggle-panel h1 {
    color: #ffffff;
    margin-bottom: 12px;
    opacity: 0;
    animation: fadeInScale 0.6s ease-out 0.5s forwards;
}

.toggle-panel p {
    margin-bottom: 24px;
    font-size: 14px;
    opacity: 0;
    animation: fadeInScale 0.6s ease-out 0.7s forwards;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.toggle-panel.toggle-left {
    left: 0;
    transition-delay: 1.2s;
}

.container.active .toggle-panel.toggle-left {
    left: -50%;
    transition-delay: 0.6s;
}

.toggle-panel.toggle-right {
    right: -50%;
    transition-delay: 0.6s;
}

.container.active .toggle-panel.toggle-right {
    right: 0;
    transition-delay: 1.2s;
}

.toggle-panel .btn {
    width: 180px;
    height: 50px;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: none;
    backdrop-filter: blur(10px);
    animation: none;
    opacity: 1;
}

.toggle-panel .btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.2);
}

/* Registration specific styles */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 12px 0;
}

.form-grid .input-box {
    margin: 0;
}

.full-width {
    grid-column: 1 / -1;
}

.verification-section {
    display: none;
    margin: 16px 0;
    animation: expandIn 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.verification-section.show {
    display: block;
}

@keyframes expandIn {
    from {
        opacity: 0;
        transform: scaleY(0);
        transform-origin: top;
    }
    to {
        opacity: 1;
        transform: scaleY(1);
    }
}

.code-input {
    text-align: center;
    font-family: "SF Mono", "Monaco", "Inconsolata", "Roboto Mono", monospace;
    letter-spacing: 3px;
    font-size: 18px;
    font-weight: 600;
}

/* Enhanced Password Strength Indicator */
.password-strength {
    margin: 12px 0;
    padding: 16px;
    background: rgba(248, 250, 252, 0.8);
    border-radius: 12px;
    border-left: 4px solid #3b82f6;
    backdrop-filter: blur(10px);
    animation: slideInLeft 0.5s ease-out;
}

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

.strength-bars {
    display: flex;
    gap: 4px;
    margin: 8px 0;
}

.strength-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    flex: 1;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}

.strength-bar::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 ease;
}

.strength-bar.active::before {
    left: 100%;
}

.strength-bar.active.weak {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}
.strength-bar.active.medium {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}
.strength-bar.active.strong {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.requirements {
    font-size: 12px;
    color: #64748b;
    margin-top: 8px;
}

.requirements .req {
    display: flex;
    align-items: center;
    margin: 4px 0;
    transition: all 0.3s ease;
    padding: 2px 0;
}

.requirements .req.met {
    color: #10b981;
    transform: translateX(5px);
}

.requirements .req i {
    margin-right: 8px;
    font-size: 10px;
    transition: all 0.3s ease;
}

.requirements .req.met i {
    transform: scale(1.2);
}

/* FIXED: Enhanced Department Dropdown with Proper Z-Index */
.department-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-radius: 12px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 9999; /* Very high z-index to ensure it appears above everything */
    display: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15),
        0 8px 32px rgba(59, 130, 246, 0.1);
    animation: dropdownSlide 0.3s ease-out;
    margin-top: 4px;
}

/* Ensure the input container has proper stacking context */
.input-box {
    position: relative;
    z-index: 1;
}

.input-box:focus-within {
    z-index: 10000; /* Even higher when focused to ensure dropdown appears */
}

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

.department-dropdown.show {
    display: block;
}

.department-item {
    padding: 14px 18px;
    cursor: pointer;
    border-bottom: 1px solid rgba(241, 245, 249, 0.5);
    font-size: 13px;
    transition: all 0.3s ease;
    position: relative;
    background: transparent;
}

.department-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    transition: width 0.3s ease;
    opacity: 0.1;
    z-index: -1;
}

.department-item:hover::before {
    width: 100%;
}

.department-item:hover {
    background: rgba(59, 130, 246, 0.05);
    transform: translateX(5px);
    color: #1e293b;
}

.department-item:last-child {
    border-bottom: none;
}

/* Enhanced Spinner Animation */
.spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Enhanced Alert System */
.alert {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 20px;
    border-radius: 12px;
    z-index: 10001; /* Higher than dropdown */
    max-width: 350px;
    animation: alertSlideIn 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid;
    backdrop-filter: blur(20px);
}

@keyframes alertSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.alert.success {
    background: rgba(240, 253, 244, 0.95);
    color: #166534;
    border-color: rgba(187, 247, 208, 0.8);
}

.alert.error {
    background: rgba(254, 242, 242, 0.95);
    color: #991b1b;
    border-color: rgba(254, 202, 202, 0.8);
}

.alert.warning {
    background: rgba(255, 251, 235, 0.95);
    color: #92400e;
    border-color: rgba(254, 215, 170, 0.8);
}

/* Enhanced Step Indicator */
.step-indicator {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    gap: 10px;
}

.step {
    width: 30px;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}

.step::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.5),
        transparent
    );
    transition: left 0.5s ease;
}

.step.active {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    transform: scaleY(1.5);
}

.step.active::before {
    left: 100%;
}

.step.completed {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.mobile-toggle {
    display: none;
}

/* Mobile Responsive Design */
@media screen and (max-width: 900px) {
    .container {
        width: 95%;
        min-height: 90vh;
        margin: 10px;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .form-box {
        padding: 30px 20px;
    }
}

@media screen and (max-width: 650px) {
    body {
        padding: 0;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }

    .container {
        width: 100%;
        height: calc(100vh - 40px);
        border-radius: 0;
        margin: 0;
        box-shadow: none;
        border: none;
    }

    .form-box {
        bottom: 0;
        width: 100%;
        height: 70%;
        padding: 20px;
        overflow-y: auto;
        justify-content: flex-start;
        padding-top: 40px;
        right: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(20px);
    }

    .container.active .form-box {
        right: 0;
        bottom: 30%;
    }

    .toggle-box::before {
        left: 0;
        top: -270%;
        width: 100%;
        height: 300%;
        border-radius: 20vw;
    }

    .container.active .toggle-box::before {
        left: 0;
        top: 70%;
    }

    .container.active .toggle-panel.toggle-left {
        left: 0;
        top: -30%;
    }

    .toggle-panel {
        width: 100%;
        height: 30%;
    }

    .toggle-panel.toggle-left {
        top: 0;
    }

    .toggle-panel.toggle-right {
        right: 0;
        bottom: -30%;
    }

    .container.active .toggle-panel.toggle-right {
        bottom: 0;
    }

    .mobile-toggle {
        display: block;
        text-align: center;
        margin: 24px 0;
        padding: 16px;
        background: rgba(248, 250, 252, 0.8);
        border-radius: 12px;
        border: 1px solid rgba(226, 232, 240, 0.5);
        backdrop-filter: blur(10px);
    }

    .mobile-toggle button {
        background: none;
        border: none;
        color: #3b82f6;
        font-size: 18px; /* Further increased font size */
        cursor: pointer;
        font-weight: 600;
        padding: 15px 30px; /* Further increased padding */
        border-radius: 10px;
        transition: all 0.3s ease;
    }

    .mobile-toggle button:hover {
        background: rgba(59, 130, 246, 0.1);
        color: #1d4ed8;
        transform: translateY(-1px);
    }

    .mobile-compact {
        padding: 16px;
        justify-content: flex-start;
    }

    .mobile-compact .container h1 {
        font-size: 22px;
        margin-bottom: 6px;
    }

    .mobile-compact .container p {
        font-size: 13px;
        margin-bottom: 16px;
    }

    .mobile-compact .form-grid {
        gap: 6px;
        margin: 8px 0;
    }

    .mobile-compact .input-box {
        margin: 6px 0;
    }

    .mobile-compact .input-box input {
        padding: 12px 45px 12px 14px;
        font-size: 14px;
        height: 44px;
    }

    .mobile-compact .btn {
        height: 44px;
        font-size: 14px;
        margin: 8px 0;
    }

    .mobile-compact .password-strength {
        padding: 10px;
        margin: 8px 0;
    }

    .mobile-compact .requirements {
        font-size: 11px;
    }

    .mobile-compact .requirements .req {
        margin: 2px 0;
    }

    .mobile-compact .step-indicator {
        margin: 12px 0;
    }

    .mobile-compact .step {
        width: 20px;
        height: 2px;
    }

    .mobile-compact .department-dropdown {
        max-height: 150px;
        font-size: 12px;
        z-index: 9999;
    }

    .mobile-compact .department-item {
        padding: 10px 12px;
        font-size: 12px;
    }

    .toggle-panel .btn {
        width: 220px; /* Increased width for mobile */
        height: 55px; /* Increased height for mobile */
        font-size: 16px; /* Increased font size for mobile */
        padding: 10px 20px; /* Added padding for mobile */
    }

    .alert {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        font-size: 13px;
    }
}

@media screen and (max-width: 400px) {
    .form-box {
        padding: 20px;
    }

    .toggle-panel h1 {
        font-size: 30px;
    }

    .mobile-compact {
        padding: 12px;
    }

    .mobile-compact .input-box input {
        padding: 10px 40px 10px 12px;
        font-size: 13px;
        height: 42px;
    }

    .mobile-compact .btn {
        height: 42px;
        font-size: 13px;
    }

    .mobile-compact .container h1 {
        font-size: 20px;
    }

    .mobile-compact .form-grid {
        gap: 4px;
    }

    .mobile-compact .input-box {
        margin: 4px 0;
    }

    .code-input {
        font-size: 15px;
        letter-spacing: 1px;
    }
}

/* Smooth scroll for mobile */
@media screen and (max-width: 650px) {
    .form-box {
        scroll-behavior: smooth;
    }
}

/* Edu Mail Hint Styles */
.edu-mail-hint {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #93c5fd;
    border-radius: 12px;
    padding: 12px 15px;
    margin-bottom: 20px;
    text-align: left;
    animation: fadeInUp 0.6s ease-out 0.5s forwards;
    opacity: 0;
}

.edu-mail-hint i {
    color: #f59e0b;
    font-size: 18px;
    margin-top: 2px;
    flex-shrink: 0;
}

.edu-mail-hint span {
    font-size: 13px;
    color: #1e40af;
    line-height: 1.5;
}

.edu-mail-hint strong {
    color: #1e3a8a;
    font-weight: 600;
}

@media screen and (max-width: 650px) {
    .edu-mail-hint {
        padding: 10px 12px;
        margin-bottom: 15px;
    }

    .edu-mail-hint i {
        font-size: 16px;
    }

    .edu-mail-hint span {
        font-size: 12px;
    }
}
