@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');


/* ------------- ROOT VARAIBLES ------------- */
:root {
    --color-primary: #28aa17;
    --color-danger: #ff7782;
    --color-success: #41f1b6;
    --color-verde: #99e631;
    --color-warning: #ffbb55;
    --color-white: #fff;
    --color-info-dark: #7d8da1;
    --color-info-light: #dce1eb;
    --color-dark: #363949;
    --color-light: rgba(132, 139, 200, 0.18);
    --color-primary-variant: #111e88;
    --color-dark-variant: #677483;
    --color-background: #f6f6f9;

    --card-border-radius: 2rem;
    --border-radius-1: 0.4rem;
    --border-radius-2: 0.8rem;
    --border-radius-3: 1.2rem;

    --card-padding: 1.8rem;
    --padding-1: 1.2rem;

    --box-shadow: 0 2rem 3rem var(--color-light);
}

/* ---------------- DARK THEME VARIABLES ---------------- */
.dark-theme-variables {
    --color-background: #181a1e;
    --color-white: #202528;
    --color-dark: #edefdd;
    --color-dark-variant: #a3bdcc;
    --color-light: rgba(0, 0, 0, 0.4);
    --box-shadow: 0 2rem 3rem var(--color-light);
}


*{
    margin: 0;
    padding: 0;
    outline: 0;
    appearance: none;
    border: 0;
    text-decoration: none;
    list-style: none;
    box-sizing: border-box;
}

html{
    font-size: 14px;
}

body{
    width: 100vw;
    height: 100vh;
    font-family: poppins, sans-serif;
    font-size: 0.88rem;
    background: var(--color-background);
    user-select: none;
    overflow-x: hidden;
    color: var(--color-dark);
}

.container{
    display: grid;
    width: 96%;
    margin: 0 auto;
    gap: 1.8rem;
    grid-template-columns: 14rem auto 23rem;
}

a{
    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: 0.87rem;
}

h4{
    font-size: 0.8rem;
}

h5{
    font-size: 0.77rem;
}

small{
    font-size: 0.75rem;
}

.profile-photo{
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 50%;
    overflow: hidden;
}

.text-muted{
    color: var(--color-info-dark);
}

p{
    color: var(--color-dark-variant);
}

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);
}

.verde{
    color: var(--color-verde);
}

aside{
    height: 100vh;
}

aside .top{
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.4rem;
}

aside .logo{
    display: flex;
    gap: 0.8rem;
}

aside .logo img{
    width: 2rem;
    height: 2rem;
}

aside .close{
    display: none;
}

aside .sidebar {
    display: flex;
    flex-direction: column;
    height: 86vh;
    position: relative;
    top: 3rem;
}

aside h3{
    font-weight: 500;
}

aside .sidebar a{
    display: flex;
    color: var(--color-info-dark);
    margin-left: 2rem;
    gap: 1rem;
    align-items: center;
    position: relative;
    height: 3.7rem;
    transform: all 300ms ease;
}

aside .sidebar a span{
    font-size: 1.6rem;
    transition: all 300ms ease;
}

aside .sidebar a:last-child{
    position: absolute;
    bottom:  2rem;
    width: 100%;
}

aside .sidebar a.active{
    background: var(color --color-light);
    color: var(--color-primary);
    margin-left: 0;
}

aside .sidebar a.active:before{
    content: '';
    width: 6px;
    height: 100%;
    background: var(--color-primary);
}

aside .sidebar a.active span{
    color: var(--color-primary);
    margin-left: calc(1rem - 3px);
}

aside .sidebar a:hover{
    color: var(--color-primary);
}

aside .sidebar a:hover span{
    margin-left: 1rem;
}

/* =========== MAIN ============ */

main {
    margin-top: 1.4rem;
}

main .date {
    display: inline-block;
    background: var(--color-light);
    border-radius: var(--border-radius-1);
    margin-top: 1rem;
    padding: 0.5rem 1.6rem;
}

main .date input[type='date'] {
    background: transparent;
    color: var(--color-dark);
}

main .insights {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.6rem;
}

main .insights > div {
    background: 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;
}

main .insights > div:hover {
    box-shadow: none;
}

main .insights > div span {
    background: var(--color-primary);
    padding: 0.5rem;
    border-radius: 50%;
    color: var(--color-white);
    font-size: 2rem;
}

main .insights > div.temperatura span {
    background: var(--color-danger);
}

main .insights > div.humedad span {
    background: var(--color-primary-variant);
}

main .insights > div.humedadsuelo span {
    background: var(--color-warning);
}

main .insights > div .middle {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

main .insights h3 {
    margin: 1rem 0 0.6rem;
    font-size: 1rem;
}

main .insights .progress {
    position: relative;
    width: 92px;
    height: 92px;
    border-radius: 50%;
}

main .insights svg {
    width: 7rem;
    height: 7rem;
    transform: rotate(-90deg); /* Rotar para que el progreso inicie desde arriba */
}

main .insights svg circle {
    fill: none;
    stroke-width: 14;
    stroke-linecap: round;
    transform: translate(5px, 5px);
    transition: stroke-dashoffset 0.5s ease; /* Animación suave */
}

/* Círculo base (fondo) */
main .insights svg circle:nth-child(1) {
    stroke: var(--color-light);
    stroke-dasharray: 110;
    stroke-dashoffset: 0;
}

/* Círculo dinámico (progreso) */
main .insights svg circle:nth-child(2) {
    stroke: var(--color-primary); /* Color inicial, modificado dinámicamente */
    stroke-dasharray: 110;
    stroke-dashoffset: 110; /* Valor inicial: círculo vacío */
}

/* Colores específicos para cada sensor */
main .insights > div.temperatura svg circle:nth-child(2) {
    stroke: var(--color-danger);
}

main .insights > div.humedad svg circle:nth-child(2) {
    stroke: var(--color-primary-variant);
}

main .insights > div.humedadsuelo svg circle:nth-child(2) {
    stroke: var(--color-warning);
}

/* Texto en el centro del círculo */
main .insights .progress .number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    font-weight: bold;
    color: var(--color-dark);
}

/* Fondo del círculo */
.progress svg circle:nth-child(1) {
    stroke: var(--color-light);
    stroke-dasharray: 226;
    stroke-dashoffset: 0;
}

/* Progreso dinámico */
.progress svg circle:nth-child(2) {
    stroke-dasharray: 226; /* Circunferencia del círculo */
    stroke-dashoffset: 226; /* Inicialmente vacío */
}

/*=======Right====== */

.right{
    margin-top: 1.4rem;
}

.right .top{
    display: flex;
    justify-content: end;
    gap: 2rem;
}

.right .top button{
    display: none;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: bold;
    color: white;
    background-color: var(--color-primary);
    border: none;
    border-radius: var(--border-radius-2);
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn:hover {
    background-color: var(--color-primary-variant);
}


.right .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);
}

.right .theme-toggler span{
    font-size: 1.2rem;
    width: 50%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.right .theme-toggler span.active{
    background: var(--color-primary);
    color: white;
    border-radius: var(--border-radius-1);
}

.right .top .profile{
    display: flex;
    gap: 2rem;
    text-align: right;
}

/* MODAL CSS */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.hidden {
    display: none;
}

.modal-content {
    background: var(--color-white);
    padding: 2rem;
    border-radius: 1.2rem;
    text-align: center;
    position: relative;
    width: 350px;
    max-width: 90%;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
}

.modal-title {
    margin-bottom: 1rem;
    font-size: 1.5rem;
    color: var(--color-dark);
}

.modal-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background-color: var(--color-light);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px auto;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
    transition: 0.3s ease;
}

.modal-circle h1 {
    font-size: 2rem;
    color: var(--color-dark);
    margin: 0;
}


.modal-description {
    margin-top: 1rem;
    font-size: 0.95rem;
    color: var(--color-info-dark);
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-danger);
}

/* === Account Settings === */
.account-card {
    background: var(--color-white);
    padding: 2rem;
    border-radius: var(--card-border-radius);
    box-shadow: var(--box-shadow);
    margin-top: 2rem;
}

.account-card h2 {
    margin-bottom: 1rem;
    color: var(--color-dark);
}

.account-info p {
    margin: 0.5rem 0;
    font-size: 1rem;
    color: var(--color-dark-variant);
}

/* ===== Support Chat ===== */
.chat-container {
  background: var(--color-white);
  border-radius: var(--card-border-radius);
  box-shadow: var(--box-shadow);
  padding: 1.5rem;
  height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.chat-box {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.message {
  padding: 0.7rem 1rem;
  border-radius: var(--border-radius-2);
  max-width: 70%;
  word-wrap: break-word;
}

.message.user {
  align-self: flex-end;
  background: var(--color-primary);
  color: white;
}

.message.support {
  align-self: flex-start;
  background: var(--color-light);
  color: var(--color-dark);
}

.chat-input {
  display: flex;
  gap: 0.5rem;
}

.chat-input input {
  flex: 1;
  padding: 0.7rem;
  border-radius: var(--border-radius-2);
  border: 1px solid var(--color-info-light);
  outline: none;
}



/* ===== MEDIA QUERY====== */

@media  screen and (max-width: 1200px) {
    .container {
        width: 94%;
        grid-template-columns: 7rem auto 23rem;
    }

    aside .logo h2 {
        display: none;
    }

    aside .sidebar h3{
        display: none;
    }
    
    aside .sidebar a{
        width: 5.5rem;
    }

    aside .sidebar a:last-child{
        position: relative;
        margin-top: 1.8rem;
    }

    main .insights{
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* ===== MEDIA QUERY====== */

@media  screen and (max-width: 768px) {
    .container {
        width: 100%;
        grid-template-columns: 1fr;
    }

    aside{
        position: fixed;
        left: -100%;
        background: var(--color-white);
        width: 18rem;
        z-index: 3;
        box-shadow: 1rem 3rem 4rem var(--color-light);
        height: 100vh;
        padding-right: var(--card-padding);
        display: none;
        animation: showMenu 400ms ease forwards;
    }

    @keyframes showMenu {
        to{
            left: 0;
        }
        
    }

    aside .logo{
        margin-left: 1rem;
    }

    aside .logo h2 {
        display: inline;
    }

    aside .sidebar h3{
        display: inline;
    }
    
    aside .sidebar a{
        width: 100%;
        height: 3.4rem;
    }

    aside .sidebar a:last-child{
        position: relative;
        margin-top: 5rem;
    }

    aside .close{
        display: inline-block;
        cursor: pointer;
    }

    main{
        margin-top: 8rem;
        padding: 0 1rem;
    }

    .right{
        width: 94%;
        margin: 0 auto 4rem;
    }

    .right .top{
        position: fixed;
        top: 0;
        left: 0;
        align-items: center;
        padding: 0 0.8rem;
        height: 4.6rem;
        background: var(--color-white);
        width: 100%;
        margin: 0;
        z-index: 2;
        box-shadow: 0 1rem 1rem var(--color-light);
    }

    .right .top .theme-toggler{
        width: 4.4rem;
        position: absolute;
        left: 66%;
    }

    .right .top button{
        display: inline-block;
        background: transparent;
        cursor: pointer;
        color: var(--color-dark);
        position: absolute;
        left: 1rem;
    }

    .right .top button span{
        font-size: 2rem;
    }
}

