* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Arial", sans-serif;
}

html {
    font-size: 16px;
    background-color: #f5f5f5;
}

body {
    overflow: hidden;
}

/* HEADER */
.header {
    background: #4D148C;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 9vh;
}

#logo {
    height: 2rem;
    text-align: left;
    cursor:pointer;
}

.location {
    font-size: 1.7rem;
    font-weight: bold;
    margin-top: 0.8%;
    margin-right: 4.6%;
}

#manager {
    height: 2.6rem;
    text-align: right;
}

/* SUB-HEADER*/
.sub-header {
    background: #9166be;
    height: 7vh;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-around;
}

.icon {
    cursor: pointer;
}

#history {
    height: 2.4rem;
}
#trend {
    height: 2.6rem;
}
#hide {
    height: 2.7rem;
    margin-top: 0.3rem;
}
#filter {
    height: 2.5rem;
}

.icon:hover {
    color: #FF6200;
    transform: scale(1.1);
}

.system-health {
    font-size: 1.2rem;
}

/* MAIN ALERT GRID */
.alert-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);  /* make ALL 4 cells equal height */
    height: 84vh;  /* fill full screen minus header/subheader */
    gap: 2rem;                         /* adjust spacing */
    padding: 2rem;
}

/* HIDDEN CARDS VIEW */
.alert-container.hidden-view, .history-cards.active {
    display: flex !important;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2rem;
    height: 84vh;
}

.alert-container.hidden-view .alert-card, .history-cards.active .alert-card{
    position: relative !important;
    transform: none !important;
    width: 100% !important;
    max-width: 60rem;
    margin: 0 auto;
    min-height: 25rem;
    width: 60vw;
    height: 60vh;
    flex-shrink: 0;
    flex-grow: 0;
}

/* ALERT CARDS */
.alert-card {
    background: white;
    border-radius: 0.5rem;
    position: relative;
    box-shadow: 0px 6px 14px rgba(0,0,0,0.3);
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 0.1rem rem 0 0;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), 
            z-index 0s 0.2s;
}


/* CARD HEADER */
.card-header {
    background: #E92626;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 1rem;
    color: white;
}

.card-header.red {
    background: #E92626;
}
.card-header.yellow {
    background: #FFB120;
}
.card-header.green {
    background: #25D10E;
}

.alert-card.red {
    border: 3px solid #E92626;
}

.alert-card.yellow {
    border: 3px solid #FFB120;
}

.alert-card.green {
    border: 3px solid #25D10E;
}

.card-header .card-icon {
    width: 2.3rem;
    height: 2.3rem;
    object-fit: contain;
}

.card-header h2 {
    flex: 1;                         /* take remaining space */
    text-align: center;
    font-size: 1.2rem;
    margin: 0;
    font-weight: bold;
}

.card-header .card-hide-icon {
    width: 1.4rem;
    height: 1.4rem;
    cursor: pointer;
    object-fit: contain;
    position: absolute;
    top: 0.35rem;
    right: 0.5rem;
}

.card-header .card-hide-icon:hover {
    transform: scale(1.1);
}

/* CARD BODY */
.card-body {
    padding: 2rem;
    text-align: center;
}

.card-body h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.card-body p {
    font-size: 1rem;
    margin-bottom: 0.3rem;
}

.stack {
    position: relative;
    width: 100%;
    height: 100%; 
    cursor: pointer; 
}

.alert-card {
    position: absolute;
    inset: 0;
}

.stack-1 {
    transform: translate(0rem, 0rem);
    z-index: 10;
}

.stack-2 {
    transform: translate(0.6rem, -0.5rem);
    z-index: 9;
}

.stack-3 {
    transform: translate(1.2rem, -1rem);
    z-index: 8;
}

/* ZOOM-VIEW */
.alert-container.zoom-mode {
    display: flex !important;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* Hide other stacks entirely */
.stack.inactive {
    display: none !important;
}

/* Big center card */
.stack.active {
    position: relative;
    width: 60vw;
    height: 60vh;
    transition: width 0.25s ease, height 0.25s ease, transform 0.25s ease;
    transform: translateY(-3rem);
}

/* Spread the 3 cards */
.stack.active .stack-1 {
    transform: translateX(0);
    z-index: 30;
}

.stack.active .stack-3 {
    transform: translateX(-40rem) translateY(1.5rem);
    z-index: 20;
}

.stack.active .stack-2 {
    transform: translateX(40rem) translateY(1.5rem);
    z-index: 10;
}

#bottomSwitch {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 2rem;
}

#bottomSwitch.active {
    display: flex;
}

#bottomSwitch img {
    width: 4rem;
    height: 4rem;
    cursor: pointer;
    opacity: 0.8;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

#bottomSwitch img:hover {
    opacity: 1;
    transform: scale(1.15);
}

/* Hide extra details by default */
.extra-details {
    display: none;
}

/* Show extra details in zoom mode */
.stack.active .extra-details, .alert-container.hidden-view .extra-details, .history-cards .extra-details {
    display: block;
}

.main-details {
    display: block;
}
.stack.active .main-details, .alert-container.hidden-view .main-details, .history-cards .main-details {
    display: none;
}

.hide {
    display: none !important;
}

#trends-page {
    position: fixed;
    top: 16vh;
    left: 0;
    width: 100vw;
    height: 84vh;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100000;
}

#trend-desktop{
    height: 100%;
    width: 100vw;
}

#trend-phone {
    height: 100%;
    width: 100vw;
    display: none;
}

.history-cards, .history-cards .card-hide-icon{
    display: none;
}

/* FILTER SECTION */
.filter-section {
    background: linear-gradient(to bottom, #b89dd9 0%, #d4c5e8 100%);
    display: none;
}

.filter-settings {
    width: 60vw;
    flex-direction: column;
    gap: 0.3rem;
    padding: 1rem 2rem;
    display: flex;
}
.filter-section.active {
    display: flex;
    justify-content: center;
}

.filter-row {
    display: grid;
    grid-template-columns: 12rem 1fr;
    align-items: center;
    gap: 5rem;
}

.filter-options {
    display: flex;
    align-items: center;
    justify-content: space-around;
    flex: 1;
}

.filter-options.date {
    justify-content: center;
}

.filter-icon {
    width: 2.5rem;
    height: 2.5rem;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
}

.filter-icon:hover, .filter-icon.pressed{
    transform: scale(1.2);
    filter: hue-rotate(90deg);
    filter: invert(1);
}

.date-input, .location-input {
    padding: 0.2rem 1rem;
    font-size: 1rem;
    border: 2px solid #9166be;
    border-radius: 0.2rem;
    background: white;
    outline: none;
}

.date-input {
    width: 10rem;
}

.location-input {
    width: 15rem;
}

.severity-btn, .location-text, .filter-label {
    font-weight: bold;
    font-size: 1.2rem;
    color: black;
}

.severity-btn { cursor: pointer;}

.severity-btn:hover, .severity-btn.selected {
    color: white;
}

@media (max-width: 600px) {
html {
    font-size: 12px;
}

body {
    overflow-y: auto;
    overflow-x: hidden;
}

#trend-desktop{
    display: none;
}

#trend-phone {
    display: block;
}

.alert-container {
    display: flex;
    flex-direction: column;
    padding: 3rem 2rem;
    height: 80rem;
    gap: 4rem;
}

.location {
    font-size: 1.5rem;
    margin-right: 15%;
    margin-top: 4%;
}
.sub-header {
    height: 5vh;
    padding: 0;
}
.header {
    padding: 0 1rem;
    height: 7vh;
}

/* Big center card */
.stack.active {
    position: relative;
    width: 90vw;
    height: 45vh;
    transform: translateY(-19rem);
}

.alert-container.hidden-view .alert-card, .history-cards.active .alert-card{
    height: 45vh;
}

/* Spread the 3 cards */

.stack.active .stack-3 {
    transform: translateX(-18rem) translateY(3rem);
}

.stack.active .stack-2 {
    transform: translateX(18rem) translateY(3rem);
}

#bottomSwitch {
    bottom: 3rem;
    gap: 3rem;
}

#bottomSwitch img {
    width: 6rem;
    height: 6rem;
}

#trends-page {
    top: 12vh;
    height: 88vh;
    overflow: hidden !important;
}

.filter-settings {
    width: 100vw;
    padding: 1rem 0.7rem;
}    
.filter-row {
    gap: 0;
    grid-template-columns: 8rem 1fr;
}

}

@media (max-height: 600px) {

.card-body h3 {

    font-size: 1rem;
} 
.card-body p {
    font-size: 0.8rem;
}

.card-body {
    padding: 1rem;
}

#history {
    height: 1.8rem;
}
#trend {
    height: 2rem;
}
#hide {
    height: 2.1rem;
}
#filter {
    height: 1.9rem;
}

.severity-btn, .location-text, .filter-label {
    font-size: 1rem;
}

.filter-icon {
    width: 1.5rem;
    height: 1.5rem;
}

.date-input, .location-input {
    padding: 0.1rem 0.8rem;
    font-size: 0.8rem;
}
}
