:root {
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --primary: #0066cc;
    --primary-light: #e6f0ff;
    --text-main: #1c1e21;
    --text-muted: #65676b;
    --success: #00a400;
    --success-bg: #e7f3ff;
    /* Will refine */
    --error: #fa3e3e;
    --border-color: #dddfe2;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-family);
    display: flex;
    justify-content: center;
    padding: 20px;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 1.8rem;
    color: var(--primary);
}

h1 {
    font-size: 1.4rem;
    font-weight: 700;
}

.btn-icon {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.status-card {
    background: white;
    border-radius: 16px;
    padding: 30px 20px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    border: 1px solid var(--border-color);
}

.status-circle {
    width: 100px;
    height: 100px;
    background: var(--bg-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.inner-circle {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

#status-text {
    font-size: 1.2rem;
    font-weight: 700;
}

#instruction-text {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.btn {
    border: none;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: background 0.2s;
}

.btn.primary {
    background: var(--primary);
    color: white;
}

.btn.secondary {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.log-section {
    background: white;
    border-radius: 16px;
    padding: 15px;
    border: 1px solid var(--border-color);
}

#total-hours-display {
    padding: 15px;
    background: #e7f3ff;
    color: #0066cc;
    border-radius: 12px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 20px;
}

.history-list-container {
    max-height: 300px;
    overflow-y: auto;
}

.log-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--bg-color);
}

.log-item:last-child {
    border-bottom: none;
}

.log-info {
    display: flex;
    flex-direction: column;
}

.log-time {
    font-weight: 700;
    font-size: 1rem;
}

.log-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.log-type {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 800;
}

/* Specific colors requested: Green for Entry, Red for Exit */
.log-type.entry {
    background-color: #e6f4ea;
    color: var(--success);
}

.log-type.exit {
    background-color: #fce8e6;
    color: var(--error);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 20px;
    width: 90%;
    max-width: 400px;
}

/* SIDE PANEL as requested */
.modal-content.side-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    height: 100%;
    width: 80%;
    max-width: 320px;
    border-radius: 0;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

#qr-reader {
    border-radius: 12px;
    overflow: hidden;
}

/* Status card colors */
.status-card.success {
    border-left: 5px solid var(--success);
}

.status-card.error {
    border-left: 5px solid var(--error);
}

footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.hidden {
    display: none !important;
}