:root {
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --accent-color: #DA1212;
    --accent-gradient: linear-gradient(135deg, #DA1212, #ef4444);
    --text-color: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --font-family: 'Inter', 'Kanit', sans-serif;
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.04), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    margin: 0;
}

.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: url('img/srmd.png') no-repeat center center/cover;
}

.background-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(241, 245, 249, 0.85), rgba(255, 255, 255, 0.6));
    backdrop-filter: blur(2px);
}

.login-container {
    width: 100%;
    max-width: 460px;
    z-index: 10;
}

.login-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 50px 40px;
    box-shadow: var(--card-shadow);
    text-align: center;
    position: relative;
    overflow: visible;
    animation: cardEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardEnter {
    from { opacity: 0; transform: translateY(40px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.card-header {
    margin-bottom: 35px;
}

.header-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 24px;
}

.card-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-color);
}

.card-header p.sub-title {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 400;
}

.input-group {
    position: relative;
    margin-bottom: 18px;
}

.input-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1.1rem;
    transition: color 0.2s;
}

input[type="text"], input[type="password"], select.styled-select {
    width: 100%;
    background: #fcfcfc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 15px 16px 48px;
    color: var(--text-color);
    font-family: var(--font-family);
    font-size: 1rem;
    transition: all 0.25s ease;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent-color);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(218, 18, 18, 0.1);
}

input:focus + .input-icon {
    color: var(--accent-color);
}

.login-btn {
    width: 100%;
    padding: 16px;
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    border-radius: 0;
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-family);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: none;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: none;
}

.error-message {
    color: var(--accent-color);
    background: #fee2e2;
    padding: 14px 20px;
    border-radius: 0;
    margin-bottom: 25px;
    font-size: 0.85rem;
    border-left: 4px solid var(--accent-color);
    text-align: left;
}

.or-separator {
    color: #64748b;
    font-weight: 600;
    margin: 30px 0;
    text-align: center;
    font-size: 0.8rem;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.or-separator::before, .or-separator::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 35%;
    height: 1px;
    background: #e2e8f0;
}
.or-separator::before { left: 0; }
.or-separator::after { right: 0; }

.status-message {
    font-size: 0.85rem;
    text-align: left;
    margin-top: -12px;
    margin-bottom: 20px;
    min-height: 1.2em;
}

.logout-secondary {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.85rem;
    margin-top: 25px;
    display: inline-block;
    transition: all 0.2s;
    font-weight: 500;
}
.logout-secondary:hover { 
    color: var(--accent-color); 
    text-decoration: underline;
}

/* Custom Styled Select */
select.styled-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 18px center;
    background-size: 1em;
}

/* Custom Dropdown UI */
.custom-select-wrapper {
    position: relative;
    user-select: none;
    width: 100%;
}
.custom-select-trigger {
    background: #fcfcfc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 40px 16px 48px;
    color: var(--text-color);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.25s ease;
    text-align: left;
}
.custom-select-wrapper.open .custom-select-trigger {
    border-color: var(--accent-color);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(218, 18, 18, 0.1);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
.custom-select-trigger .arrow {
    position: absolute;
    right: 18px;
    color: #94a3b8;
    transition: transform 0.3s;
}
.custom-select-wrapper.open .custom-select-trigger .arrow {
    transform: rotate(180deg);
}
.custom-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--accent-color);
    border-top: none;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    z-index: 99;
    max-height: 280px;
    overflow-y: auto;
    display: none;
    list-style: none;
}
.custom-select-wrapper.open .custom-options {
    display: block;
}
.custom-option {
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s;
}
.custom-option:last-child {
    border-bottom: none;
}
.custom-option:hover {
    background: #f8fafc;
}
.custom-option.selected {
    background: #eef2ff;
    border-left: 3px solid var(--accent-color);
}
.opt-zone {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 4px;
}
.opt-name {
    font-weight: 600;
    color: var(--accent-color);
    font-size: 1rem;
    margin-bottom: 4px;
}
.opt-dates {
    font-size: 0.8rem;
    color: #475569;
}
.opt-dates .date-event { color: #f59e0b; font-weight: 500; }
.opt-dates .date-walk { color: #10b981; font-weight: 500; }

.custom-select-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    z-index: 2;
    transition: color 0.2s;
}
.custom-select-wrapper.open ~ .custom-select-icon {
    color: var(--accent-color);
}

/* Media Queries */
@media (max-width: 480px) {
    body { padding: 15px; }
    .login-card { padding: 35px 20px; border-radius: 0; }
    .header-logo { width: 80px; height: 80px; }
    .login-btn { padding: 18px; }
}