* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #43cea2 0%, #185a9d 100%);
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
}

header {
    background: #fff;
    padding: 1.5rem 1rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(33,147,176,0.07);
    border-radius: 0 0 24px 24px;
}

header h1 {
    margin: 0;
    color: #185a9d;
    font-size: clamp(1.5rem, 5vw, 2.2rem);
    letter-spacing: 1px;
}

main {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    padding: 2rem 1rem;
    max-width: 1400px;
    margin: 0 auto;
}

.card {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 2px 12px rgba(33,147,176,0.10);
    padding: 1.5rem;
    min-width: 280px;
    max-width: 450px;
    width: 100%;
    flex: 1 1 350px;
    margin-bottom: 1rem;
}

.card h2 {
    color: #185a9d;
    margin-top: 0;
    font-size: clamp(1.3rem, 4vw, 1.8rem);
}

form {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

input, select, button {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    border: 1.5px solid #ececec;
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    width: 100%;
}

input:focus, select:focus {
    outline: none;
    border-color: #43cea2;
    box-shadow: 0 0 0 3px rgba(67, 206, 162, 0.1);
}

button {
    background: linear-gradient(90deg, #43cea2 0%, #185a9d 100%);
    color: #fff;
    font-weight: bold;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    touch-action: manipulation;
}

button:hover:not(:disabled) {
    background: linear-gradient(90deg, #185a9d 0%, #43cea2 100%);
    transform: translateY(-2px) scale(1.02);
}

button:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#registerMsg {
    margin-top: 1rem;
    color: #388e3c;
    font-weight: 600;
}

#emergencyList {
    margin-top: 1rem;
    font-size: clamp(0.85rem, 2vw, 0.98rem);
}

/* Responsive Tables */
table {
    width: 100%;
    overflow-x: auto;
    display: block;
}

@media (max-width: 768px) {
    header {
        padding: 1rem 0.5rem;
        border-radius: 0 0 16px 16px;
    }
    
    main {
        padding: 1.5rem 0.75rem;
        gap: 1.5rem;
    }
    
    .card {
        padding: 1.2rem;
        border-radius: 12px;
        max-width: 100%;
        min-width: 100%;
    }
    
    form {
        gap: 0.8rem;
    }
    
    input, select, button {
        padding: 0.9rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Make tables scrollable on mobile */
    table {
        font-size: 0.85rem;
    }
    
    th, td {
        padding: 0.5rem 0.3rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.3rem;
    }
    
    main {
        padding: 1rem 0.5rem;
    }
    
    .card {
        padding: 1rem;
        border-radius: 10px;
    }
    
    .card h2 {
        font-size: 1.2rem;
    }
}
