:root {
    --splash-head-color: #4690fd;
    --splash-foot-color: #dee2ff;

    --header-primary-color: #6ba5fc;
    --header-secondary-color: #dee2ff;
    --header-border-color: #9191918f;
    --header-user-avatar-bg: rgba(255, 255, 255, 0.479);
    --header-icon-color: #212529;
    --header-avater-shadow: 0 2px 6px rgba(0,0,0,0.1);

    --primary-color: #0062ff;
    --secondary-color: #00c6ff;
    --accent-color: #ff7a18;

    --bg-color: #f8f9fa;
    --card-bg: #ffffff;

    --text-dark: #212529;
    --text-light: #6c757d;

    --border-radius: 12px;
    --shadow-soft: 0 4px 10px rgba(0,0,0,0.1);
    --shadow-strong: 0 8px 25px rgba(0,0,0,0.15);
}

html, body {
    height: 100%;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
    font-family:system-ui;
    background:var(--bg-color);
    color:var(--text-dark);
}

.app {
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    min-height: 0;
}

.scroll-area {flex: 1; overflow-y: auto; min-height: 0; scroll-behavior:smooth;}
.scroll-area::-webkit-scrollbar{width:0;}

.custom-modal{
    position:fixed;
    inset:0;

    display:flex;
    align-items:center;
    justify-content:center;

    z-index:2000;
}

.custom-modal-overlay{
    position:absolute;
    inset:0;

    background:rgba(0,0,0,0.45);
}

.custom-modal-content{
    position:relative;

    width:90%;
    max-width:420px;

    background:white;

    border-radius:14px;

    box-shadow:0 10px 30px rgba(0,0,0,0.25);
}

.custom-modal-header{
    display:flex;
    justify-content:space-between;
    align-items:center;

    padding:12px 16px;

    border-bottom:1px solid #eee;
}

.custom-modal-body{
    padding:16px;
    max-height:60vh;
    overflow:auto;
}

.global-image-modal-overlay {
    display: none; 
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.global-image-modal-overlay.active {
    display: flex;
    opacity: 1;
}

/* Controls Container */
.global-modal-controls {
    position: absolute;
    top: 20px;
    right: 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 10000;
}

#global-image-modal-rotate-btn {
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

#global-modal-close {
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

/* THE FIX: Constraints for Portrait Images */
.global-modal-content-wrapper {
    width: 90vw;
    height: 80vh; /* Limits total height to 80% of screen */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#global-modal-image-target {
    max-width: 100%;
    max-height: 100%; /* Image will never exceed the wrapper height */
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#global-modal-caption {
    margin-top: 20px;
    color: #fff;
    font-family: sans-serif;
    font-weight: 500;
}


/* App Dialog for custom alert and confirm */
.app-dialog{
    position: fixed;
    inset: 0;
    z-index: 3000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 1rem;
}

.app-dialog-backdrop{
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(2px);
}

.app-dialog-box{
    position: relative;
    width: 100%;
    max-width: 24rem;
    background: var(--card-bg);
    color: var(--text-dark);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(0,0,0,0.22);
    animation: appDialogShow 0.2s ease;
}

.app-dialog-header{
    padding: 1rem 1rem 0.75rem;
    background: var(--primary-color);
    color: #fff;
}

.app-dialog-title{
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
}

.app-dialog-body{
    padding: 1rem;
    font-size: 0.95rem;
    color: var(--text-dark);
    max-height: 55vh;
    overflow-y: auto;
}

.app-dialog-footer{
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 0 1rem 1rem;
}

.app-dialog-btn{
    min-width: 5.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    padding: 0.55rem 1rem;
    border: none;
}

.app-dialog-ok{
    color: #fff;
}

.app-dialog-cancel{
    background: #e9ecef;
    color: var(--text-dark);
}

.app-dialog-btn:active{
    transform: scale(0.95);
}

@keyframes appDialogShow{
    from{
        opacity: 0;
        transform: translateY(12px) scale(0.97);
    }
    to{
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.animate-fade { animation: fadeIn 0.2s ease-in; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.animate-pulse-red {
    animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

.animate-pulse-blue {
    animation: pulse-blue 1.5s infinite;
}
@keyframes pulse-blue {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(54, 162, 235, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(54, 162, 235, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(54, 162, 235, 0); }
}

