/*=====================================
  BASE STYLES & LAYOUT
=======================================*/
body {
    margin: 0;
    font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
    background: linear-gradient(45deg, #6200ff, #00c3ff, #6200ff, #00c3ff);
}
/* Specific style for Derivative page */
body:has(.topnav a[href="derivative.html"].active) {
    background: linear-gradient(45deg, #00ffb7, #00c3ff, #00ffb7, #00c3ff);
}
/* Specific style for Series page */
body:has(.topnav a[href="series.html"].active) {
    background: linear-gradient(45deg, #a040ff, #ff0095, #a040ff, #ff0095);
}
/* Specific style for Index page */
body:has(.topnav a[href="index.html"].active) {
    background: linear-gradient(45deg, #6200ff, #00c3ff);
}


.card {
    padding: 2rem;
    margin: 2rem;
    background: white;
    border-radius: 2rem;
    font-family: 'Courier New', Courier, monospace;
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.2);
    color: black;
    position: relative; 
    text-align: center; /* Ensures content inside is centered */
}
/* Card size optimization for login/register pages */
body:has(.butts) .card {
    max-width: 50%;
    margin-left: auto;
    margin-right: auto;
}
.wrapper { /* Used in index.html */
    overflow: hidden;
    margin: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2rem;
    background: white;
    border-radius: 2rem;
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.2);
}


/*=====================================
  NAVIGATION BAR (TOPNAV)
=======================================*/
.topnav {
    display: flex;
    overflow: visible;
    background-color: #333;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.topnav a {
    float: left;
    display: block;
    color: #f2f2f2;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
    font-size: 1rem;
}

.topnav a:hover {
    background-color: #ddd;
    color: black;
    animation-duration: 0.1s;
}

.topnav a.active {
    background: white;
    font-family: Courier, monospace;
    font-weight: 1000;
    color: #333;
    text-align: center;
    width: 30%;
}

.topnav .icon {
    display: none;
}


/*=====================================
  TEXT, TITLE, & ANIMATION
=======================================*/
.title {
    color: #6200ff;
    font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
    font-size: clamp(2rem, 4vw, 4rem);
    padding: 1rem 0;
    text-align: center;
    max-width: 100%;
    /* margin: 0 auto; - Removed as typewriter handles alignment */
}
.pronoun { /* Mobile title for index.html */
    display: none;
    font-size: clamp(1.3rem, 5vw, 4rem);
}

.subtitle {
    font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
    color: #333;
    font-size: clamp(1rem, 2vw, 2rem);
    font-weight: bolder;
    padding: 1rem 0;
    max-width: 100%;
    margin: 0 auto;
}
.description {
    font-size: clamp(0.75rem, 2vw, 1.5rem);
    padding-bottom: 1rem;
    padding-left : clamp(1rem, 2vw, 4rem);
    padding-right : clamp(1rem, 2vw, 4rem);
    text-align: center;
}
.oauth{ /* From login/register */
    font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
    color: #333;
    font-weight: bolder;
}

/* Typewriter Animation - Crucial for center alignment */
.typewriter {
    color: #6200ff;
    font-family: monospace;
    overflow: hidden;
    border-right: .15em solid orange;
    white-space: nowrap;
    margin: 0 auto; /* ALIGNMENT: Centers the block */
    letter-spacing: .15em;
    animation: typing 3.5s steps(30, end), blink-caret .5s step-end infinite;
}

@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

@keyframes blink-caret {
    from, to { border-color: transparent }
    30% { border-color: orange }
}


/*=====================================
  INPUTS & BUTTONS
=======================================*/
.selection {
    outline: none;
    font-family: inherit;
    font-size: inherit;
    border-radius: 1rem;
    color: #009171;
    border: 2px solid #009171;
    background: white;
    padding: 0.5rem;
    margin: 1rem 0;

    /* Overrides for Login/Register Input boxes */
    display: flex;
    justify-content: center;
    align-items: center;
    width: 80%;
    text-align: center;
    color: #6200ff;
    border: 2px solid #6200ff;
    margin: 1rem auto;
}
#n, #terms, #x, #time {
    width: 60%;
}
.hidden {
    display: none;
}

.butts { /* Action buttons (Submit, Integral, etc.) */
    background: linear-gradient(200deg, #7200cf, #00a6cf); /* From Login */
    color: white;
    font-size: clamp(1.5rem, 5vw, 2rem);
    padding: 1rem 3rem;
    margin: 1rem;
    border: 2px solid white;
    border-radius: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(1rem, 5vw, 1.5rem);
}
.butts:hover {
    background: linear-gradient(200deg, #7200cf, #00a6cf);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    border: 2px solid #7200cf;
}
.buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}
/* Specific style for index.html buttons */
.wrapper .buttons .butts {
    background: linear-gradient(200deg, rgb(0, 209, 105), #00cfa2);
    padding: 1.5rem;
    font-size: clamp(1.5rem, 5vw, 2rem);
}
.wrapper .buttons .butts:hover {
    background: linear-gradient(200deg, rgb(0, 209, 139), #00cfa2);
    border: 2px solid #00cfa2;
}

/*=====================================
  IMAGE & SOCIALS
=======================================*/
.image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 0 auto;
    overflow: hidden;
}
/* Default style for content images (Riemann, Series, Derivative) */
.image-container img {
    max-width: 70%;
    height: auto;
    display: block;
    justify-content: center;
    padding: 1rem;
    cursor: pointer;
}
/* Override for Login/Register/Social icons */
.card .image-container .auth, .social-icons img { 
    width: 40px; 
    height: auto;
    display: inline-block;
    padding: 1rem;
    transition: transform 0.2s;
    max-width: none;
}
.card .image-container .auth:hover {
    transform: scale(1.2);
}

.social {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2rem;
    margin: 2rem;
    background: white;
    border-radius: 2rem;
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.2);
    font-family: 'Courier New', Courier, monospace;
    color: black;
}
.social-icons img {
    max-width: 60px; /* Revert social icons back to large size */
    padding: 1rem 4rem;
}
.social-icons img:hover {
    transform: scale(1.2);
}
.social-icons {
    display: inline-block;
    gap: 0.75rem;
    font-size: 1rem;
    padding: 0.5rem 1rem;
}
.links {
    display: none;
}
a {
    text-decoration: none;
    color: inherit;
}
/* Drop area for Register */
.drop-area {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 150px;
    width: 200px;
    border: 2px solid;
    text-align: center;
    margin: 0 auto;
}
/* Image container on Index (large logo) */
#hoverimage img {
    width: 300px;
    height: 300px;
    transition: opacity 0.5s ease-in-out;
    opacity: 1;
    padding: 2rem;
    max-width: none; 
}
#hoverimage img.fade-out {
    opacity: 0;
}
/* Song title display */
#songtitlesmall {
    display: none;
}
.songtitle {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;          /* add space between icon and text */
    animation: moveAndColor 2s forwards; /* play once and stop at the end */
}

.pp img {
    width: 36px; 
    height: 36px;
    border-radius: 50%;
}
#pp {
    display: flex;           
    margin-left: auto; 
    align-items: center;   
    padding: 0 10px;     
}

.profile-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.profile-dropdown img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 50px;
    right: 0;
    background-color: #f9f9f9;
    color: red;
    opacity: 0.95;
    min-width: 80px;
    box-shadow: 0px 8px 16px rgba(0,0,0,0.2);
    border-radius: 5px;
    z-index: 1000; /* pastikan muncul di atas navbar */
}

.dropdown-content a {
    color: red;
    padding: 8px 12px;
    text-decoration: none;
    display: block;
}

.dropdown-content a:hover {
    color: red;     
    background: none; 
    cursor: pointer;  
    transform: none;  
    box-shadow: none; 
}


.profile-dropdown:hover .dropdown-content {
    display: block;
}

.show-dropdown {
    display: block !important;
}

@keyframes moveAndColor {
    0% { left: 100%; color: rgb(89, 0, 255); }
    20% { color: rgb(0, 162, 255); }
    40% { color: rgb(0, 255, 221); }
    60% { color: rgb(0, 255, 0); }
    80% { color: rgb(0, 255, 221); }
    100% { left: 5%; color: rgb(0, 162, 255); }
}


/*=====================================
  SLIDER STYLES (RANGE)
=======================================*/
input[type=range] {
    -webkit-appearance: none;
}
input[type=range]::-webkit-slider-runnable-track {
    height: 8px;
    background: #00cfa2;
    border-radius: 5px;
}
input[type=range]::-moz-range-track {
    height: 8px;
    background: #00cfa2;
    border-radius: 5px;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #08101a;
    border-radius: 50%;
    cursor: pointer;
    margin-top: -6px;
}
input[type=range]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #08101a;
    border-radius: 50%;
    cursor: pointer;
}
input[type=range]:hover::-webkit-slider-thumb {
    background: #fffb00;
}

#login{
    display: flex;         
    margin-left: auto;
}
.login{
    display: flex;         
    margin-left: auto;
}
/*=====================================
  CANVAS & OUTPUT STYLES
=======================================*/
canvas {
    width: 100%;
    height: auto;
    max-width: 900px;
    max-height: 600px; 
    display: block;
    margin: 0 auto;
    padding: 1.5rem 0;
}
/* Specific height adjustment for Series */
body:has(.topnav a[href="series.html"].active) canvas {
    max-height: 400px;
}
#result-display { /* For Limit Calculator */
    font-size: clamp(1rem, 2.5vw, 2.5rem);
    font-weight: bold;
    color: #6200ff;
    margin-top: 1rem;
}

.topnav a.prof{
    display: none;
}
.copyright{
    color: white;
}
/*=====================================
  COPYRIGHT STYLES 
=======================================*/
.copyright {
    color: white; 
    text-align: center; 
    font-size: 0.9rem;
    margin: 0;
    padding: 1rem 0; 
}

.logged-out-hide {
    display: none !important; 
}
.topnav .login {
    margin-left: auto; /* Push to the right */
    display: flex;
    align-items: center;
    padding: 14px 16px; /* Match other nav items */
}
.topnav a {
    transition: all 0.3s ease-in-out;
}

.topnav .dropdown-content {
    transition: all 0.3s ease-in-out;
}
/*=====================================
  MEDIA QUERIES (RESPONSIVENESS)
=======================================*/
/*=====================================
  MEDIA QUERIES (RESPONSIVENESS)
=======================================*/
@media screen and (max-width: 1000px) {
    .topnav.responsive .login,
    .topnav.responsive .profile-dropdown {
        display: none !important;
    }
    /* NAVIGATION */
    .topnav a {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    .topnav a.profile-dropdown{
        right: 0;
    }
    .topnav .login {
        position: absolute;
        right: 50px; /* Place before hamburger icon */
        top: 0;
        display: flex; /* Ensure it’s visible */
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    .navcontent{
        display: block;
    }
    .topnav a:not(:first-child):not(.login):not(.icon) { display: none; }


    .topnav .icon {
        display: block;
        position: absolute;
        right: 0;
        top: 0;
    }
    .topnav.responsive { position: relative;}
    .topnav.responsive .icon { position: absolute; right: 0; top: 0; }
    .topnav.responsive a { float: none; display: block; text-align: left; }
    .topnav a.active { text-align: center; }
    .topnav.responsive .navcontent a {
        display: block !important;
        text-align: left !important;
        }
    
    .nav-right {
    display: flex;
    align-items: center;
    gap: 0.5rem; /* jarak kecil antara PP & burger */
    position: absolute;
    right: 10px;
    top: 8px;
    }

    .topnav.responsive #pp{
        display: none;
    }

    .topnav #pp{
        margin-right: 0;
    }
    .topnav a.icon {
        float: none; /* Prevent float: left from affecting icon */
    }
    .topnav .profile-dropdown {
        position: absolute;
        right: 50px; /* Same position as login */
        top: 0;
        display: none; /* Hidden by default */
    }
    /* LAYOUT & CARDS */
    .wrapper { display: block; } 
    .content { max-width: 100%; }
    .social { padding: 1rem; }
    
    /* Login/Register Mobile Card Size */
    body:has(.butts) .card { max-width: 80%; } 
    
    /* TITLES & TEXT */
    .title { display: none; } 
    .pronoun { display: Block; } /* Mobile title Index shown */
    .subtitle { font-size: 1rem; text-align: center; max-width: 100%; }
    
    /* IMAGES */
    .image-container img { max-width: 100%; }
    #hoverimage img { width: 60%; max-width: 220px; height: auto; padding: 1rem; }
    
    /* SOCIAL ICONS */
    .social-icons img { max-width: 30px; padding: 0.5rem 1rem; } 
    .social-icons {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        font-size: 1rem;
        font-weight: bold;
        color: black;
        padding: 0.5rem 1rem;
        justify-content: center;
    }
    .links { display: inline; }
    
    /* INPUTS & SLIDERS */
    #n, #terms, #x, #time { width: 100%; }

    /* DROP AREA */
    .drop-area { height: 120px; width: 160px; }
    
    /* SONG TITLE */
    #songtitlebig{ display: none; }
    #songtitlesmall { display: flex; justify-content: center; }
}
