:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --logo-size: 160px; /* single source of truth for logo sizing */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    /* ensure the large logo isn't clipped by the viewport top (accounts for mobile safe area) */
    padding-top: calc(var(--logo-size) * 0.5 + env(safe-area-inset-top, 0px) + 8px);
}

.container {
    background: white;
    padding: calc(var(--logo-size) * 0.5 + 2rem) 2rem 2rem; /* extra top padding to accommodate larger logo */
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
    position: relative;
}

h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

input:focus {
    border-color: var(--secondary-color);
    outline: none;
}

button {
    width: 100%;
    padding: 1rem;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #2980b9;
}

/* Logo placeholder that sits centered and overlapping the top of the white box */
.logo-placeholder {
    position: absolute;
    /* place at the top center and lift by half its own height */
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: white;
    padding: 6px; /* small breathing room around the image */
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    border-radius: 6px;
    border: 4px solid white;
}

.logo-image {
    display: block;
    max-width: var(--logo-size);
    max-height: calc(var(--logo-size) * 1);
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Make the logo scale down on very small viewports */
@media (max-width: 420px) {
    :root { --logo-size: 120px; }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    margin: auto;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 420px;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem 2rem 1rem;
    text-align: center;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.modal-body {
    padding: 2rem;
}

.modal-body p {
    margin: 0 0 1.5rem;
    color: #555;
    text-align: center;
}

.modal-button {
    width: 100%;
    padding: 1rem;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s;
    margin-top: 1rem;
}

.modal-button:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.modal-button:active {
    transform: translateY(0);
}

.modal-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    text-align: center;
}

.modal-footer small {
    color: #888;
    font-size: 0.85rem;
}

.access-error {
    display: none;
    color: #c00;
    background-color: #fee;
    padding: 0.75rem;
    border-radius: 4px;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    text-align: center;
    border-left: 4px solid #c00;
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Ensure modal input has proper styling */
#accessPassword {
    width: 100%;
    padding: 1rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: all 0.3s;
}

#accessPassword:focus {
    border-color: var(--secondary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}