@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@200;300;400;500;600;700;800;900&family=Poppins:wght@300;400;500;600;700;800&display=swap');

:root {
    --color-primary: #00796B;
    --color-danger: #ff7782;
    --color-success: #41f1b6;
    --color-warning: #ffbb55;
    --color-white: #fff;
    --color-info: #7d8da1;
    --color-dark: #363949;
    --color-light: rgba(132, 139, 200, 0.18);
    --color-dark-varient: #677483;
    --color-background: #f6f6f9;

    --card-border-radius: 2rem;
    --border-radius-1: 0.4rem;
    --border-radius-2: 1.2rem;

    --card-padding: 1.8rem;
    --box-shadow: 0 2rem 3rem var(--color-light)
}

body.dark-theme {
    --color-background: #181a1e;
    --color-white: #202528;
    --color-dark: #edeffd;
    --color-dark-varient: #a3bdcc;
    --color-light: rgba(0, 0, 0, 0.4);
    --box-shadow: 0 2rem 3rem var(--color-light);
}



* {
    margin: 0;
    padding: 0;
    text-decoration: none;
    list-style: none;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    font-size: .88rem;
    background: var(--color-background);
    user-select: none;
    overflow-x: hidden;
    color: var(--color-dark);
}

* {
    color: var(--color-dark);
}


img {
    display: block;
    width: 100%;
}

h1 {
    font-weight: 800;
    font-size: 1.8rem;
}

h2 {
    font-size: 1.4rem;
}

h3 {
    font-size: .87rem;
}

h4 {
    font-size: .8rem;
}

h5 {
    font-size: .77rem;
}

small {
    font-size: .75rem;
}

.text-muted {
    color: var(--color-info);
}

p {
    color: var(--color-dark-varient);
}

b {
    color: var(--color-dark);
}

.primary {
    color: var(--color-primary);
}

.danger {
    color: var(--color-danger);
}

.success {
    color: var(--color-success)
}

.warning {
    color: var(--color-warning);
}

.container {
    position: relative;
    display: grid;
    width: 93%;
    margin: 0 3rem;
    gap: 1.8rem;
    grid-template-columns: 14rem auto 23rem;
    padding-top: 4rem;
}

header h3 {
    font-weight: 500;
}

header {
    position: fixed;
    width: 100vw;
    z-index: 1000;
    background-color: var(--color-background);
}

header.active {
    box-shadow: var(--box-shadow);
}

header .logo {
    display: flex;
    gap: .8rem;
    margin-right: auto;
}

header .logo img {
    width: 3rem;
    height: 3rem;
}

header,
header .navbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 3rem;
    color: var(--color-info);
}

header .navbar a {
    display: flex;
    margin-left: 2rem;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    position: relative;
    height: 3.7rem;
    transition: all 300ms ease;
    padding: 0 2rem;
}

header .navbar a:hover {
    padding-top: 1.5rem;
}

header .navbar a.active {
    background: var(--color-light);
    color: var(--color-primary);
}

header .navbar a.active::before {
    content: "";
    background-color: var(--color-primary);
    position: absolute;
    height: 5px;
    width: 100%;
    left: 0;
    top: 0;
}

header #profile-btn {
    display: none;
    font-size: 2rem;
    margin: .5rem 2rem 0 0;
    cursor: pointer;
}

header .theme-toggler {
    background: var(--color-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 1.6rem;
    width: 4.2rem;
    cursor: pointer;
    border-radius: var(--border-radius-1);
    margin-right: 2rem;
}

header .theme-toggler span {
    font-size: 1.2rem;
    width: 50%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

header .theme-toggler span.active {
    background-color: var(--color-primary);
    color: white;
    border-radius: var(--border-radius-1);
}



/* Profile section  */
aside .profile {
    margin-top: 2rem;
    width: 13rem;
    position: fixed;
}

aside .profile .top {
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--color-light);
    padding-bottom: 1rem;
}

aside .profile .top:hover .profile-photo {
    scale: 1.05;
}

aside .profile .top .profile-photo {
    width: 6rem;
    height: 6rem;
    border-radius: 50%;
    overflow: hidden;
    border: 5px solid var(--color-light);
    transition: all 400ms ease;
}

aside .profile .about p {
    padding-bottom: 1rem;
}

aside .profile .about {
    margin-top: 1rem;
}

/* Home Section  */

main {
    position: relative;
    margin-top: 1.4rem;
}

main .subjects {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.6rem;
}

main .subjects>div {
    background-color: var(--color-white);
    padding: var(--card-padding);
    border-radius: var(--card-border-radius);
    margin-top: 1rem;
    box-shadow: var(--box-shadow);
    transition: all 300ms ease;

    min-height: 240px;
    min-width: 160px;
}

main .subjects>div:hover {
    box-shadow: none;
}

main .subjects>div span {
    background-color: var(--color-primary);
    padding: .5rem;
    border-radius: 50%;
    color: var(--color-white);
    font-size: 1.5rem;
}

main .subjects>div.mth span,
main .subjects>div.cg span {
    background: var(--color-danger);
}

main .subjects>div.cs span {
    background: var(--color-success);
}

main .subjects h3 {
    min-width: 124px;
    min-height: 30px;
    margin: 1rem 0 0.6rem;
    font-size: 1rem;
}

main .subjects h2 {
    min-width: 124px;
    min-height: 20px;
    margin: 1rem 0 0.6rem;
    font-size: 1rem;
}


main .subjects .progress {
    position: relative;
    width: 89px;
    height: 89px;
    border-radius: 50%;
    margin: auto;
}

main .subjects svg circle {
    fill: none;
    stroke: var(--color-primary);
    stroke-width: 6;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 40px 40px;
    transition: stroke-dashoffset 0.6s ease;
}
main .subjects .progress .number {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

main .subjects small {
    margin-top: 1rem;
    display: block;
}

.digital-card-heading {
    font-size: 1.8rem;
    font-weight: 800;
    color: #333;
    margin-bottom: 1.5rem;
    text-align: center;
}

.qr-card {
    width: 320px;
    background: #00796B;
    border-radius: 12px;
    color: white;
    font-family: 'Poppins', sans-serif;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.qr-card-header {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    background-color: #00796B;
}

.qr-card-text h3 {
    margin: 2.3rem 0 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.qr-card-text p {
    margin: 0.3rem 0 0;
    font-size: 0.9rem;
    color: #cceee9;
}

.qr-card-photo img {
    width: 100px;
    height: 122px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid #fff;
}

.qr-card-body {
    background: white;
    color: black;
    padding: 0.5rem;
    text-align: center;
}

.qr-card-body img {
    width: 200px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    margin-top: 1rem !important;
    margin-bottom: 0.5rem;
    margin-left: 2rem;
    min-height: 280px;
}

.qr-card-body p {
    font-size: 0.8rem;
    margin: 0;
}

.qr-card-footer {
    background-color: #005f55;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.75rem;
    color: #e0f2f1;
}


.subject-line {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.subject {
    font-weight: 600;
    color: #333;
}

.faculty {
    font-weight: bold;
    color: #555;
    font-size: 1.55rem;
}


@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* MEDIA QUERIES  */
@media screen and (max-width: 1200px) {
    html {
        font-size: 12px;
    }

    .container {
        grid-template-columns: 13rem auto 20rem;
    }

    header {
        position: fixed;
    }

    .container {
        padding-top: 4rem;
    }

    header .logo h2 {
        display: none;
    }

    header .navbar h3 {
        display: none;
    }

    header .navbar a {
        width: 4.5rem;
        padding: 0 1rem;
    }

    main .subjects {
        grid-template-columns: repeat(2, 1fr);
        gap: 1;
    }


}




@media screen and (max-width: 768px) {
    html {
        font-size: 10px;
    }

    header {
        padding: 0 .8rem;
    }

    .container {
        width: 100%;
        grid-template-columns: 1fr;
        margin: 0;
    }

    header #profile-btn {
        display: inline;
    }

    header .navbar {
        padding: 0;
        /* width: 100%; */
    }

    header .navbar a {
        margin: 0 .5rem 0 0;
    }

    header .theme-toggler {
        margin: 0;
    }


    aside {
        position: absolute;
        top: 4rem;
        left: 0;
        right: 0;
        background-color: var(--color-white);
        padding-left: 2rem;
        transform: translateX(-100%);
        z-index: 10;
        width: 18rem;
        height: 100%;
        box-shadow: 1rem 3rem 4rem var(--color-light);
        transition: all 2s ease;
    }

    aside.active {
        transform: translateX(0);
    }

    main {
        padding: 0 2rem;
    }

    .right {
        width: 100%;
        padding: 2rem;
    }
}

/* Layout: Column on mobile, row on desktop */
.main-container {
    margin-top: 3rem;
}

.responsive-layout {
    display: flex;
    flex-direction: column;
    gap: 5rem;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* QR section styles */
.qr-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

#qrImage {
    width: 80%;
    max-width: 300px;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-top: 3.8rem;
}

/* Desktop layout */
@media screen and (min-width: 768px) {
    .responsive-layout {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-around;
    }

    .attendance-section {
        flex: 1;
    }

    .qr-section {
        margin-right: 2rem;
        align-items: center;
        text-align: center;
    }
}

@media screen and (max-width: 768px) {
    main .subjects svg {
        max-width: 80px;
    }
}

/* Mobile-first layout: full screen card view */
@media (max-width: 768px) {
    .main-container {
        display: flex;
        flex-direction: column;
        align-items: center;
    }


    .qr-card {
        width: 90%;
        margin-top: 1rem;
        margin-left: 2rem;
    }

    .attendance-section {
        width: 100%;
        margin-top: 2rem;
        padding: 1rem;
    }

    .subjects {
        display: flex;
        flex-direction: column;
        gap: 1.2rem;
    }

    .qr-card-photo img {
        max-width: 100px;
        max-height: 100px;

    }

    .qr-card-body img {
        margin-left: 3.3rem;
    }

    .qr-card-text h3 {
        margin-top: 3rem;
        font-size: 1.7rem;
    }

    .qr-card-text p {
        font-size: 1.4rem;
    }

    .qr-card-body p {
        font-size: 1.4rem;
    }

    .qr-card-footer {
        font-size: 1.4rem;
    }

    .container2 {
        width: 100%;
    }
}


@media screen and (max-width: 768px) {
    .responsive-layout {
        display: flex;
        flex-direction: column-reverse;
        /* This reverses the order */
        gap: 2rem;
    }

    main .container2 .today-timetable {
        min-width: 345px;
    }
}


@media screen and (min-width: 1440px) {
    main .subjects {
        grid-template-columns: repeat(4, 1fr);
    }

    main .container2 .today-timetable {
        min-width: 725px;
    }
}



.container2>section {
    margin-bottom: 2rem;
}




.today-timetable {
    background: var(--color-white);
    padding: 2rem;
    border-radius: var(--card-border-radius);
    box-shadow: var(--box-shadow);
    margin-top: 2rem;
    animation: fadeIn 0.6s ease-in-out;
}

.today-timetable h2 {
    margin-bottom: 1.2rem;
    font-size: 1.6rem;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.periods {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.period {
    background: linear-gradient(145deg, #ffffff, #e6e6e6);
    padding: 1.2rem 1.5rem;
    border-left: 6px solid var(--color-primary);
    border-radius: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.period:hover {
    transform: translateY(-4px);
}

.period .left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.period .left .material-icons-sharp {
    font-size: 2rem;
    color: var(--color-primary);
    background: #e0f2f1;
    border-radius: 50%;
    padding: 0.5rem;
}

.period .info {
    display: flex;
    flex-direction: column;
}

.period .subject {
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--color-dark);
}

.period .room {
    font-size: 0.9rem;
    color: var(--color-dark-varient);
}

.period .time {
    font-weight: bold;
    color: var(--color-info);
    font-size: 0.95rem;
    white-space: nowrap;
}

.no-classes {
    text-align: center;
    padding: 2rem;
    font-size: 1.1rem;
    color: var(--color-dark-varient);
}

@media screen and (max-width: 600px) {
  .period {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 1rem;
  }

  .period .left {
    flex-direction: row;
    align-items: flex-start;
    gap: 1rem;
    width: 100%;
  }

  .period .left .material-icons-sharp {
    font-size: 1.6rem;
    padding: 0.4rem;
  }

  .period .info {
    flex-grow: 1;
  }

  .period .subject {
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--color-dark);
}
.period .faculty {
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-dark);
}
  .period .room {
    font-size: 0.85rem;
  }

  .period .time {
    align-self: flex-end;
    font-size: 0.9rem;
    margin-left: auto;
    margin-top: -1.5rem;
  }
}



.announcement-section {
    background: var(--color-white);
    padding: 2rem;
    border-radius: var(--card-border-radius);
    box-shadow: var(--box-shadow);
    margin-top: 2rem;
    animation: fadeIn 0.6s ease-in-out;
}

.announcement-section h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.4rem;
    color: var(--color-primary);
    margin-bottom: 3rem;
}

.announcement-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 300px;
    overflow-y: auto;
}

.announcement-list li {
    padding: 1rem;
    border-left: 5px solid var(--color-primary);
    background: linear-gradient(145deg, #ffffff, #e6e6e6);
    margin-bottom: 1rem;
    border-radius: var(--border-radius-2);
    font-size: 0.95rem;
    color: var(--color-dark-varient);
    box-shadow: var(--box-shadow);
    transition: transform 0.3s ease;
}

.announcement-list li:hover {
    transform: translateY(-3px);
}

.announcement-list {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    margin-top: 1rem;
}


.announcement-card:hover {
    transform: translateY(-4px);
}


.copy-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--color-primary);
  font-size: 1.2rem;
}

.copy-btn:hover {
  color: var(--color-dark);
}

.copy-popup {
  position: absolute;
  bottom: 0.8rem;
  right: 0.8rem;
  background-color: #00796B;
  color: white;
  padding: 0.3rem 0.7rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 10;
}

.copy-popup.show {
  opacity: 1;
}


.announcement-card {
  position: relative; /* For absolute copy button */
  background-color: var(--color-white);
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 1rem;
  box-shadow: var(--box-shadow);
  user-select: text;
  word-break: break-word;
}

.announcement-title {
  font-weight: bold;
  font-size: 1rem;
  margin-bottom: 0.3rem;
}

.announcement-subtitle {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 0.5rem;
}

.announcement-content {
  font-size: 0.9rem;
  color: #333;
  white-space: pre-wrap;
}

.announcement-link {
  color: #00796B;
  text-decoration: underline;
  word-break: break-word;
  cursor: pointer;
}


/* for dark-mode */

/* === Dark Theme Fixes for Timetable and Announcements === */
body.dark-theme .today-timetable,
body.dark-theme .announcement-section {
  background: var(--color-white); /* Dark theme value: #202528 */
  color: var(--color-dark);       /* Dark theme value: #edeffd */
}

body.dark-theme .period {
  background: linear-gradient(145deg, #2a2f36, #1f2328); /* darker shades */
  color: var(--color-dark);
}

body.dark-theme .period .subject,
body.dark-theme .period .room,
body.dark-theme .period .time {
  color: var(--color-dark-varient);
}

body.dark-theme .announcement-card,
body.dark-theme .announcement-list li {
  background: linear-gradient(145deg, #2a2f36, #1f2328); /* dark alternative */
  color: var(--color-dark);
  box-shadow: var(--box-shadow);
}

body.dark-theme .announcement-subtitle,
body.dark-theme .announcement-content {
  color: var(--color-dark-varient);
}

body.dark-theme .copy-btn {
  color: var(--color-primary);
}

body.dark-theme .copy-btn:hover {
  color: var(--color-dark);
}

body.dark-theme .announcement-link {
  color: var(--color-primary);
}

body.dark-theme .right-section h1 {
  color: var(--color-dark) !important;
}



#spinner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 6px solid transparent;
  border-top: 6px solid var(--color-primary); /* main accent color */
  border-radius: 50%;
  animation: spin 0.8s ease-in-out infinite;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  background: linear-gradient(to bottom right, var(--color-light), transparent);
}
  
@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

img {
  -webkit-user-drag: none;
  user-drag: none;
}
.spinner-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-color: var(--color-background);
}
