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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
}

body.public-page {
    background: #333333;
    align-items: center;
}

body {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1200px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 40px;
    margin-top: 20px;
}

.public-container {
    border-radius: 0 100px 0 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border-bottom: 18px solid #0066cc;
    min-height: 800px;
    display: flex;
    flex-direction: column;
}

.public-container .home-screen {
    flex: 1;
}

/* Brand color bottom borders for location pages */
.public-container.location-anco {
    border-bottom-color: #f78d1e;
}

.public-container.location-beaverswood {
    border-bottom-color: #194780;
}

.public-container.location-brandsafe {
    border-bottom-color: #f0c000;
}

.public-container.location-rack-group {
    border-bottom-color: #39889E;
}

.public-container.location-device {
    border-bottom-color: #0066cc;
}

/* Typography */
h1 {
    font-size: 2.5rem;
    margin-bottom: 30px;
    text-align: center;
    color: #333;
}

h2 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: #333;
}

h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #555;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

/* Form & Input */
input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: #0066cc;
}

.form-group {
    margin-bottom: 25px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
    text-align: center;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-large {
    padding: 30px 60px;
    font-size: 1.95rem;
    width: 100%;
    margin-bottom: 15px;
}

.btn-small {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.btn-signin {
    background: #28a745;
    color: white;
}

.btn-signin:hover {
    background: #218838;
}

.btn-signout {
    background: #dc3545;
    color: white;
}

.btn-signout:hover {
    background: #c82333;
}

.btn-back {
    background: #6c757d;
    color: white;
}

.btn-back:hover {
    background: #5a6268;
}

.btn-home {
    background: #0066cc;
    color: white;
}

.btn-home:hover {
    background: #0052a3;
}

.btn-staff {
    background: #28a745;
    color: white;
}

.btn-staff:hover {
    background: #218838;
}

.btn-visitor {
    background: #8b5cf6;
    color: white;
}

.btn-visitor:hover {
    background: #7c3aed;
}

.btn-location {
    background: #f0f0f0;
    color: #333;
    width: 48%;
    margin: 1%;
    padding: 15px;
    border: 2px solid #ddd;
}

.btn-location.active {
    background: #0066cc;
    color: white;
    border-color: #0066cc;
}

.btn-signout-action {
    background: #dc3545;
    color: white;
    padding: 8px 12px;
    margin-top: 10px;
}

/* Button groups */
.button-group,
.location-buttons,
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.button-group .btn {
    flex: 1;
    min-width: 150px;
}

.location-buttons {
    display: flex;
    flex-wrap: wrap;
}

.action-buttons {
    justify-content: space-around;
    margin-top: 30px;
}

/* Home screen */
.home-screen {
    text-align: center;
    display: grid;
    grid-template-rows: 2fr 1fr;
    width: 100%;
    height: 100%;
}

.home-header {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.home-header h1 {
    margin-bottom: 0;
    margin-top: 20px;
}

.home-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-top: 2px solid #ddd;
    height: 100%;
}

.home-actions .button-group {
    width: 100%;
    padding: 0 40px;
    margin: 0;
}

.home-actions .btn-large {
    margin-bottom: 0;
}

.home-screen h1 {
    margin-bottom: 20px;
}

.location-logo {
    max-width: 900px;
    height: auto;
    margin: 0 auto 30px;
    display: block;
}

.form-logo {
    max-width: 100%;
    height: auto;
    margin: 0 0 20px 0;
    display: block;
}

.location-subtitle {
    font-size: 1.95rem;
    font-weight: 500;
    color: #666;
    margin-bottom: 40px;
    text-transform: none;
    letter-spacing: 0px;
}

/* Sign-in screen */
.signin-screen {
    max-width: 600px;
}

.signin-screen h1 {
    margin-bottom: 40px;
}

/* Autocomplete */
.autocomplete-list {
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.autocomplete-list:not(:empty) {
    display: block;
}

.autocomplete-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background 0.1s;
}

.autocomplete-item:hover {
    background: #f5f5f5;
}

/* Confirmation screen */
.confirmation {
    text-align: center;
    padding: 40px 20px;
    background: #f0f8ff;
    border-radius: 8px;
}

.confirmation h2 {
    font-size: 2rem;
    color: #28a745;
    margin-bottom: 20px;
}

.confirm-name {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    margin: 15px 0;
}

.confirm-location {
    font-size: 1.1rem;
    color: #666;
    margin: 10px 0;
}

.confirm-time {
    font-size: 1.2rem;
    color: #0066cc;
    margin: 15px 0;
}

.countdown {
    font-size: 1rem;
    color: #999;
    margin: 20px 0;
    font-style: italic;
}

/* Visitor section */
.visitor-item {
    background: #f9f9f9;
    padding: 15px;
    margin: 10px 0;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid #0066cc;
}

.visitor-info {
    flex: 1;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-left: 10px;
}

.badge.green {
    background: #d4edda;
    color: #155724;
}

.badge.red {
    background: #f8d7da;
    color: #721c24;
}

.badge.amber {
    background: #fff3cd;
    color: #856404;
}

.badge.blue {
    background: #d1ecf1;
    color: #0c5460;
}

/* Error */
.error {
    background: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
}

/* ============================================================================
   DEVICE LANDING PAGE
   ============================================================================ */


.device-login-subtitle {
    font-size: 1rem;
    color: #999;
    margin: -20px 0 20px 0;
    text-align: center;
}

/* Device landing: 2x2 grid of location buttons */
.button-group.location-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    width: 100%;
    padding: 0 40px;
}

.button-group.location-grid .btn-large {
    margin-bottom: 0;
    width: 100%;
}

/* Device landing location buttons */
.btn-location-anco {
    background: #f78d1e;
    color: white;
}

.btn-location-anco:hover {
    background: #e67e0f;
}

.btn-location-beaverswood {
    background: #194780;
    color: white;
}

.btn-location-beaverswood:hover {
    background: #122f57;
}

.btn-location-brandsafe {
    background: #f0c000;
    color: #333;
}

.btn-location-brandsafe:hover {
    background: #d9ad00;
}

.btn-location-rack-group {
    background: #39889E;
    color: white;
}

.btn-location-rack-group:hover {
    background: #2b6a7a;
}

.home-actions .btn-back {
    margin-top: 20px;
}

/* Device landing page: compact spacing */
.public-container.device-landing-container {
    min-height: auto;
}

.public-container.device-landing-container .home-screen {
    flex: none;
}

.home-screen.device-landing {
    display: flex;
    flex-direction: column;
    grid-template-rows: auto auto;
    height: auto;
    gap: 0;
}

.home-screen.device-landing .home-header {
    height: auto;
    padding: 100px 0 100px 0;
    flex: none;
}

.home-screen.device-landing .home-header h1 {
    margin-bottom: 5px;
}

.home-screen.device-landing .location-subtitle {
    margin-bottom: 5px;
    margin-top: 0;
    font-size: 1.1rem;
}

.home-screen.device-landing .home-actions {
    height: auto;
    flex: none;
    border-top: 2px solid #ddd;
    margin-top: 25px;
    padding: 40px 40px 25px 40px;
    justify-content: flex-start;
}

/* Gradient border for device landing */
.public-container.location-device {
    border-bottom: 18px solid transparent;
    border-image: linear-gradient(to right, #263655 0%, #204f78 25%, #204f78 50%, #f1a423 75%, #f3c300 100%) 0 0 1 0;
}

.location-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    margin-bottom: 50px;
    width: 100%;
}

.location-grid .location-card {
    background: linear-gradient(135deg, #f5f5f5 0%, #ffffff 100%);
    padding: 50px 30px;
    border-radius: 12px;
    border-top: 6px solid #0066cc;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 1.6rem;
    font-weight: 600;
    text-align: center;
}

.location-grid .location-card.anco-storage {
    border-top-color: #f78d1e;
}

.location-grid .location-card.beaverswood {
    border-top-color: #194780;
}

.location-grid .location-card.brandsafe {
    border-top-color: #f0c000;
}

.location-grid .location-card.rack-group {
    border-top-color: #39889E;
}

.location-grid .location-card.anco-storage:hover {
    background: linear-gradient(135deg, #fff5e6 0%, #fff9f0 100%);
}

.location-grid .location-card.beaverswood:hover {
    background: linear-gradient(135deg, #f0f4f8 0%, #f5f9ff 100%);
}

.location-grid .location-card.brandsafe:hover {
    background: linear-gradient(135deg, #fffef0 0%, #fffef5 100%);
}

.location-grid .location-card.rack-group:hover {
    background: linear-gradient(135deg, #f0f8fb 0%, #f5fbfd 100%);
}

.device-footer {
    text-align: center;
    padding: 30px 0;
    border-top: 2px solid #ddd;
    margin-top: 20px;
}

.device-footer .btn {
    min-width: 200px;
}

/* ============================================================================
   DASHBOARD STYLES
   ============================================================================ */

.dashboard {
    max-width: 1200px;
    width: 100%;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 2px solid #ddd;
    padding-bottom: 20px;
}

.dashboard-header h1 {
    margin: 0;
    text-align: left;
    flex: 1;
}

.dashboard-login {
    max-width: 400px;
    margin: 0 auto;
    text-align: center;
}

.login-form {
    background: #f9f9f9;
    padding: 30px;
    border-radius: 8px;
    margin: 30px 0;
}

.login-form form {
    text-align: left;
}

/* Dashboard nav */
.dashboard-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #ddd;
}

.nav-link {
    padding: 10px 20px;
    color: #666;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    font-weight: 600;
}

.nav-link:hover {
    color: #0066cc;
}

.nav-link.active {
    color: #0066cc;
    border-bottom-color: #0066cc;
}

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: #f0f8ff;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border-left: 4px solid #0066cc;
}

.stat-card h3 {
    color: #666;
    margin-bottom: 10px;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #0066cc;
}

/* Location cards */
.location-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.location-card {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    border-top: 4px solid #0066cc;
}

.location-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.location-card-header:hover {
    background: rgba(0, 102, 204, 0.05);
    margin: -20px;
    padding: 20px;
    border-radius: 4px;
}

.location-card h3 {
    color: #333;
    margin-bottom: 0;
    flex: 1;
}

.location-toggle {
    font-size: 1.5rem;
    color: #0066cc;
    transition: transform 0.3s ease;
    width: 30px;
    text-align: center;
}

.location-toggle.collapsed {
    transform: rotate(-90deg);
}

.location-content {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
    margin-top: 15px;
}

.location-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.location-card .count {
    font-size: 1.3rem;
    font-weight: bold;
    color: #0066cc;
    margin-bottom: 15px;
}

.staff-list {
    max-height: 400px;
    overflow-y: auto;
}

.staff-item {
    padding: 10px;
    margin: 5px 0;
    background: white;
    border-radius: 4px;
    border-left: 3px solid #28a745;
}

.staff-item.auto-out {
    border-left-color: #ffc107;
    background: #fffbf0;
}

.staff-item a {
    text-decoration: none;
    color: #0066cc;
}

.staff-item a:hover {
    text-decoration: underline;
}

.staff-item strong {
    display: block;
    margin-bottom: 5px;
}

.visitor-name-company {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.visitor-company {
    font-size: 0.9rem;
    color: #666;
    font-weight: normal;
}

.staff-tags {
    display: flex;
    gap: 6px;
    margin: 8px 0;
    flex-wrap: wrap;
}

.tag {
    display: inline-block;
    padding: 4px 10px;
    background: #e8f4f8;
    color: #0066cc;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.tag.location {
    background: #f0e8f8;
    color: #6f0066;
}

.tag.location-rg {
    background: #39889E;
    color: white;
}

.tag.location-as {
    background: #f78d1e;
    color: white;
}

.tag.location-bw {
    background: #194780;
    color: white;
}

.tag.location-bs {
    background: #f0c000;
    color: white;
}

.staff-item .time {
    font-size: 0.9rem;
    color: #999;
}

.empty {
    color: #999;
    text-align: center;
    padding: 20px;
    font-style: italic;
}

/* Employee info */
.employee-info {
    background: #f0f8ff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.employee-info p {
    margin: 10px 0;
    font-size: 1.1rem;
}

/* Attendance controls */
.attendance-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.attendance-controls .btn {
    flex: 1;
    max-width: 100px;
    background: #f0f0f0;
    color: #333;
}

.attendance-controls .btn.active {
    background: #0066cc;
    color: white;
}

/* Table */
.attendance-table {
    overflow-x: auto;
    margin-bottom: 30px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

table thead {
    background: #f0f0f0;
    border-bottom: 2px solid #ddd;
}

table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
}

table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    color: #666;
}

table tbody tr:hover {
    background: #f9f9f9;
}

table tbody tr.auto-out {
    background: #fffbf0;
}

/* Dashboard actions */
.dashboard-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 40px;
}

.dashboard-footer {
    text-align: center;
    padding: 20px;
    border-top: 2px solid #ddd;
    color: #999;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 1.8rem;
        margin-bottom: 20px;
    }

    .btn-large {
        padding: 15px 20px;
        font-size: 1.1rem;
    }

    .location-buttons {
        flex-direction: column;
    }

    .btn-location {
        width: 100%;
        margin: 5px 0;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn {
        width: 100%;
    }

    .location-cards {
        grid-template-columns: 1fr;
    }

    .button-group.location-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .button-group.location-grid .btn-large {
        padding: 20px 15px;
        font-size: 1.1rem;
    }

    .confirm-name {
        font-size: 1.2rem;
    }

    .visitor-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .visitor-item .btn {
        margin-top: 10px;
        width: 100%;
    }

    .attendance-controls {
        flex-direction: column;
    }

    .attendance-controls .btn {
        max-width: 100%;
    }

    table {
        font-size: 0.9rem;
    }

    table th,
    table td {
        padding: 8px;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
        border-radius: 4px;
    }

    h1 {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }

    h2 {
        font-size: 1.3rem;
    }

    .btn-large {
        padding: 12px 15px;
        font-size: 1rem;
    }

    .form-group {
        margin-bottom: 15px;
    }
}
