:root {
    --background-dark: #1a1a2e;
    --surface-dark: #16213e;
    --primary-color: #0f3460;
    --secondary-color: #e94560;
    --text-light: #e0e0e0;
    --text-dark: #333;
    --border-color: #555;
    --light-border-color: #444;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-dark);
    color: var(--text-light);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
}

#app-container {
    width: 100%;
    max-width: 480px;
    height: 95vh;
    max-height: 800px;
    background-color: var(--surface-dark);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.view {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    height: 5rem; /* Estimated header height */
}

main {
    padding: 1.5rem;
    overflow-y: scroll; /* Always show scrollbar */
    height: calc(100% - 5rem); /* Set height to remaining space */
}

.card {
    background-color: var(--primary-color);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.card h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.card p {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.5rem;
}

.card p i {
    color: var(--secondary-color);
}

.input-group {
    position: relative;
    margin-bottom: 1rem;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

input[type="email"],
input[type="password"],
input[type="text"],
select,
textarea {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    background-color: #2a2a4e;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    margin-bottom: 0.5rem; /* Added margin-bottom for consistent spacing */
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.3);
}

textarea {
    min-height: 100px;
    padding: 1rem;
}

.action-btn, .danger-btn, .icon-btn, button {
    width: 100%;
    padding: 1rem;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    color: white;
    background-color: var(--secondary-color);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    margin-top: 1rem; /* Added margin-top for consistent spacing */
}

.action-btn:hover, .danger-btn:hover, button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(233, 69, 96, 0.4);
}

.danger-btn {
    background-color: #b82a40;
}

.icon-btn {
    width: auto;
    padding: 0.5rem 0.8rem;
    background: none;
    font-size: 1.5rem;
}

.icon-btn:hover {
    color: var(--secondary-color);
    transform: scale(1.1);
}

.error-message {
    color: var(--secondary-color);
    text-align: center;
    margin-top: 1rem;
    font-weight: bold;
}

.actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

#checkpoints-list {
    list-style: none;
    padding: 0;
}

#checkpoints-list li {
    padding: 0.8rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: background-color 0.3s;
}

#checkpoints-list li:last-child {
    border-bottom: none;
}

#checkpoints-list li.visited {
    background-color: #2a2a4e;
    text-decoration: line-through;
    color: #888;
}

#checkpoints-list li i {
    color: var(--secondary-color);
}

.hidden {
    display: none !important;
}

/* --- Key Holder System Specific Styles --- */
h1 {
    text-align: center;
    color: var(--secondary-color);
    margin-bottom: 2rem;
    font-size: 2.5rem;
}

h2 {
    color: var(--text-light);
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

h3 {
    color: var(--text-light);
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
}

#sites-container, #keyholders-container, #callouts-container {
    background-color: var(--surface-dark);
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 5px 20px rgba(0,0,0,0.4);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

table th,
table td {
    text-align: left;
    padding: 12px 15px;
    border-bottom: 1px solid var(--light-border-color);
}

table thead th {
    background-color: var(--primary-color);
    color: var(--text-light);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

table tbody tr:nth-child(even) {
    background-color: #1e2a4a; /* Slightly lighter surface dark for alternating rows */
}

table tbody tr:hover {
    background-color: #2a3d60; /* Highlight on hover */
}

table td button {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    margin-right: 0.5rem;
    margin-top: 0;
    display: inline-flex;
    width: auto;
    min-width: 80px;
    justify-content: center;
}

table td button.danger-btn {
    background-color: #b82a40;
}

/* Modal specific styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.6); /* Black w/ opacity */
    padding-top: 60px;
}

.modal-content {
    background-color: var(--surface-dark);
    margin: 5% auto;
    padding: 30px;
    border: 1px solid var(--border-color);
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    position: relative;
}

.modal-content h3 {
    color: var(--secondary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.modal-content label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-light);
    font-weight: bold;
}

.modal-content input[type="text"] {
    padding: 10px;
    margin-bottom: 15px;
    background-color: #2a2a4e;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-light);
}

.modal-content button {
    margin-top: 20px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 36px;
    font-weight: bold;
    position: absolute;
    right: 20px;
    top: 10px;
}

.close:hover,
.close:focus {
    color: var(--secondary-color);
    text-decoration: none;
    cursor: pointer;
}

/* Adjust main padding for smaller screens if necessary */
@media (max-width: 768px) {
    body {
        padding: 0.5rem;
    }

    #app-container {
        height: 100vh;
        border-radius: 0;
    }

    main {
        padding: 1rem;
    }

    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
}