* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex-grow: 1;
}

/* Header */
header {
    background-color: #f8f9fa;
    padding: 1rem 0;
    border-bottom: 1px solid #e0e0e0;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.header-actions > .btn {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    white-space: nowrap;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sticky-nav-wrapper {
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    display: flex;
    align-items: center;
}

.logo img {
    height: 40px;
    width: auto;
    display: block;
}

.logo-text {
    font-size: 2rem;
    font-weight: 700;
    color: #2c5282;
    letter-spacing: -1px;
}

.logo-dot {
    color: #2c5282;
    font-size: 2rem;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.lang-switcher {
    display: flex;
    gap: 0.5rem;
    color: #2c5282;
    font-weight: 600;
    font-size: 0.9rem;
}

.lang-switcher a {
    color: #2c5282;
    text-decoration: none;
}

.lang-switcher a:hover {
    text-decoration: underline;
}

.menu-button {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0.5rem;
}

.menu-button span {
    width: 25px;
    height: 2px;
    background-color: #2c5282;
    display: block;
}

/* Navigation Menu */
nav {
    background-color: #2c5282;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease-out, padding 0.2s ease-out;
    padding: 0 0;
}

nav.show {
    max-height: 200px;
    padding: 0.75rem 0;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    gap: 2rem;
}

nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: opacity 0.3s;
}

nav a:hover {
    opacity: 0.8;
}

/* Filter Menu Styles */
#filter-menu {
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    padding: 2rem;
    margin-bottom: 2rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.4s ease-out;
    padding-top: 0;
    padding-bottom: 0;
}
#filter-menu.show {
    max-height: 500px;
    padding: 2rem;
}
.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}
.filter-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #2c5282 0%, #3d5a80 100%);
    color: white;
    padding: 4rem 2rem;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: white;
    overflow-wrap: break-word;
}

/* Main Content */
.container {
    max-width: 1400px;
    margin: 3rem auto;
    padding: 0 2rem;
}

.card {
    background: white;
    border-radius: 0;
    padding: 3rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h2 {
    margin-bottom: 0;
}

h1, h2 {
    color: #2c5282;
    margin-bottom: 1.5rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
}

h2 {
    font-size: 2rem;
    font-weight: 600;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2.5rem;
    flex-wrap: wrap;
}

.form-actions > .btn {
    flex: 1;
}

.flash-message {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
}

.flash-success {
    background-color: #d1fae5;
    color: #065f46;
    border-color: #a7f3d0;
}

.flash-error {
    background-color: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: #2c5282;
    font-weight: 600;
    font-size: 0.95rem;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d0d0d0;
    border-radius: 0;
    font-size: 1rem;
    transition: border-color 0.3s;
    font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #2c5282;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

.checkbox-group {
    display: flex;
    gap: 0.75rem;
}

.checkbox-group input[type="checkbox"] {
    width: 1.15em;
    height: 1.15em;
    flex-shrink: 0;
    cursor: pointer;
    margin-top: 0.25rem;
}

.checkbox-group label {
    margin-bottom: 0;
}

/* Buttons */
button.btn {
    font: inherit;
    font-weight: 600;
}

.btn {
    display: inline-block;
    padding: 0.875rem 2.5rem;
    background-color: #2c5282;
    color: white;
    border: none;
    border-radius: 0;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    text-decoration: none;
    text-align: center;
}

.btn:hover {
    background-color: #1e3a5f;
}

.btn-small {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

.btn-table-action {
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    height: auto;
    word-break: break-all;
}

.btn-uniform-width {
    width: 10.5rem;
}

.btn-secondary {
    background-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-fixed-width-action {
    width: 9rem;
}

.action-cell {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 2rem;
    table-layout: fixed;
}

th {
    background-color: #2c5282;
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
}

.visitor-table th:nth-child(1) { width: 4%; } /* ID */
.visitor-table th:nth-child(2) { width: 12%; } /* Name */
.visitor-table th:nth-child(3) { width: 11%; } /* Company */
.visitor-table th:nth-child(4) { width: 11%; } /* Contact */
.visitor-table th:nth-child(5) { width: 11%; } /* Purpose */
.visitor-table th:nth-child(6) { width: 10%; } /* Host */
.visitor-table th:nth-child(7),
.visitor-table th:nth-child(8) { width: 8%; } /* Arrival/Departure */
.visitor-table th:nth-child(9) { width: 12%; } /* Status */
.visitor-table th:nth-child(10) { width: 13%; } /* Action */

.logs-table th:nth-child(1) { width:20%, } /* Timestamp */
.logs-table th:nth-child(2) { width:20%, } /* Employee */
.logs-table th:nth-child(3) { width:45%, } /* Reason */
.logs-table th:nth-child(4) { width:15%, } /* Duration */

.contacts-table th:nth-child(1) { width: 15%; } /* Name */
.contacts-table th:nth-child(2) { width: 20%; } /* Email */
.contacts-table th:nth-child(3) { width: 15%; } /* Phone */
.contacts-table th:nth-child(4) { width: 15%; } /* Server Access */
.contacts-table th:nth-child(5) { width: 15%; } /* PIN */
.contacts-table th:nth-child(6) { width: 20%; } /* Action */

.invitation-table th:nth-child(1) { width: 15%; } /* Time */
.invitation-table th:nth-child(2) { width: 25%; } /* Visitor */
.invitation-table th:nth-child(3) { width: 20%; } /* Host */
.invitation-table th:nth-child(4) { width: 15%; } /* Token/Info */
.invitation-table th:nth-child(5) { width: 15%; } /* Status */
.invitation-table th:nth-child(6) { width: 10%; } /* Action */

td {
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

tr:hover {
    background-color: #f8f9fa;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 2px;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 7rem;
    text-align: center;
}

.status-checked-in {
    background-color: #d1fae5;
    color: #065f46;
}

.status-checked-out {
    background-color: #fee2e2;
    color: #991b1b;
}

.inactive-contact {
    color: #6c757d;
    background-color: #f8f9fa;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination a,
.pagination .active {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1p solid #d0d0d0;
    text-decoration: none;
    color: #2c5282;
    font-weight: 500;
    transition: background-color 0.3s;
}

.pagination a:hover {
    background-color: #f8f9fa;
}

.pagination .active {
    background-color: #2c5282;
    color: white;
    border-color: #2c5282;
    cursor: default;
}

/* Grid Cards */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.news-card {
    background: white;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.news-card-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    text-align: center;
    height: 100%;
}

.news-card-content .btn,
.news-card-content .card-footer-item {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-like {
    padding: 0.875rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #2c5282;
    text-decoration: none;
    cursor: default;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.9rem;
    height: 2.9rem;
    padding: 0;
    border-radius: 0;
    line-height: 1;
    flex-shrink: 0;
}

.news-card h3 {
    color: #2c5282;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.news-card p {
    color: #6c757d;
    margin-bottom: 1rem;
}

/* --- Styles for Visit Selection Page --- */
.visit-selection-list {
    margin-top: 2rem;
    border: 1px solid #e0e0e0;
}
.visit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #e0e0e0;
    transition: background-color 0.3s;
}
.visit-item:last-child {
    border-bottom: none;
}
.visit-item:hover {
    background-color: #f8f9fa;
}
.visit-item-arrow {
    font-size: 1.5rem;
    color: #2c5282;
}

/* Footer */
footer {
    background-color: #2c5282;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 4rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header-container {
        flex-direction: row;
    }

    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .card {
        padding: 1.5rem;
    }

    h1 {
        font-size: 2rem;
    }

    .hero h1 {
        font-size: 2.25rem;
    }

    table {
        font-size: 0.8rem;
    }

    th, td {
        padding: 0.5rem;
    }

    #mobile-warning + form {
        display: none;
    }
}

.text-center {
    text-align: center;
}

.text-muted-small {
    color: #6c757d;
    font-family: 0.875rem;
}

.success-checkmark {
    font-size: 5rem;
    color: #2c5282;
    margin-bottom: 1.5rem;
    font-weight: 300;
}

.clickable-row {
    cursor: pointer;
}

.details-list {
    margin-top: 2rem;
}

.details-list dt {
    font-weight: 600;
    color: #2c5282;
    margin-bottom: 0.5rem;
}

.details-list dd {
    margin-left: 0;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.details-list dd:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: #fff;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 5px solid #2c5282;
}

.stat-card-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c5282;
}

.stat-card-label {
    font-size: 1rem;
    font-weight: 600;
    color: #6c757d;
    margin-top: 0.25rem;
}

#pinModal {
    z-index: 9999;
}

/* Host Dashboard */

.host-table th:nth-child(1) { width: 40%; } /* Name */
.host-table th:nth-child(2) { width: 30%; } /* Status */
.host-table th:nth-child(3) { width: 30%; } /* Action */

.add-guest-wrapper {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 4px;
    margin-top: 2rem;
    border-top: 1px solid #e0e0e0;
}

.add-guest-form {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.bulk-actions-wrapper {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.bulk-action-form {
    flex: 1;
}

@media (max-width: 768px) {

    .container {
        padding-left: 0;
        padding-right: 0;
    }
    
    .card {
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 1rem;
        box-shadow: none;
    }

    .card-header {
        justify-content: center;
        text-align: center;
    }

    .host-table thead {
        display: none !important; 
    }

    .host-table tbody, 
    .host-table tr, 
    .host-table td {
        display: block;
        width: 100%;
        border: none;
    }

    .host-table tr {
        background-color: #ffffff;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        margin-bottom: 1rem;
        padding: 1.5rem;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);

        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .host-table td:nth-of-type(1) {
        font-size: 1.25rem;
        font-weight: 700;
        color: #2c5282;
        padding: 0 0 0.75rem 0;
        text-align: center;
    }

    .host-table td:nth-of-type(2) {
        padding: 0 0 1.25rem 0;
        display: flex;
        justify-content: center;
        width: 100%;
    }

    .host-table td:nth-of-type(3) {
        padding: 0;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center; 
    }

    .host-table td:nth-of-type(3) form {
        width: auto;
    }

    .host-table td:nth-of-type(3) .btn {
        width: auto !important;
        min-width: 9rem;
        display: inline-block;
        margin-top: 0.5rem;
    }

    .bulk-actions-wrapper {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .bulk-action-form .btn {
        width: 100%;
        height: 50px;
        font-size: 1rem;
    }

    .btn-table-action {
        padding: 0.4rem 0.5rem;
        font-size: 0.8rem;
        min-width: 0;
        width: 100%;
    }
}

.sub-card {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 4px;
    margin-bottom: 2rem;
    border-left: 5px solid #2c5282;
    position: relative;
}

.sub-card h3, 
.sub-card h4 {
    margin-top: 0;
    font-size: 1.1rem;
    color: #2c5282;
    margin-bottom: 1.5rem;
}