:root {
    --primary-color: #ea1c1c;
    --secondary-color: #ffdc2d;
    --dark-color: #333;
    --light-color: #f4f4f4;
    --danger-color: #dc3545;
    --success-color: #28a745;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

header {
    background-color: var(--light-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-links {
    display: flex;
    align-items: center;
}

.nav-links a {
    margin-left: 1rem;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.3s;
    font-size: 1em;
}

#resend-qr-btn {
    padding: 0.7rem 1rem;
}

.btn:hover {
    opacity: 0.9;
}

.btn-success {
    background: #15c559;
}

.btn-confirm {
    background: #1476b7;
}

.btn-danger {
    background: #B11B1B;
}

main {
    min-height: calc(100vh - 140px);
    padding: 2rem 0;
}

footer {
    padding: 1rem 0;
    background-color: var(--dark-color);
    color: white;
    text-align: center;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-control {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* Cards */
.card {
    background: white;
    padding: 1rem;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}

/* Utilities */
.text-center {
    text-align: center;
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

/* Toast/Popup Message */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 25px;
    background-color: white;
    color: #333;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 1000;
    display: flex;
    align-items: center;
    transform: translateY(150%);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateY(0);
}

.toast-success {
    border-left: 4px solid var(--success-color);
}

.toast-error {
    border-left: 4px solid var(--danger-color);
}

.toast-info {
    border-left: 4px solid var(--primary-color);
}

/* Message Popup styling - Simplified for Safari compatibility */
.message-popup {
    position: fixed;
    bottom: 20px;
    right: -400px; /* Start off-screen */
    max-width: 350px;
    width: 90%;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    padding: 15px;
    z-index: 1000;
    transition: right 0.5s ease-in-out;
}

.message-popup.show {
    right: 20px; /* Move on-screen */
}

.message-popup .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.message-popup .close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 5px;
}

.message-popup .message {
    padding: 8px 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message-popup .timestamp {
    display: block;
    font-size: 0.8rem;
    color: #777;
    text-align: right;
    margin-top: 5px;
}

/* Row update animation */
@keyframes rowHighlight {
    0% {
        background-color: rgba(255, 255, 167, 0.7);
    }
    70% {
        background-color: rgba(255, 255, 167, 0.4);
    }
    100% {
        background-color: transparent;
    }
}

/* Cell update animation */
@keyframes cellHighlight {
    0% {
        background-color: rgba(255, 223, 126, 1);
    }
    50% {
        background-color: rgba(255, 223, 126, 0.8);
    }
    100% {
        background-color: transparent;
    }
}

.row-updated {
    animation: rowHighlight 2s ease-out;
}

.cell-updated {
    animation: cellHighlight 2.5s ease-out;
    position: relative;
    overflow: visible;
}

/* Add a subtle border flash */
.cell-updated::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid #ffad33;
    opacity: 1;
    border-radius: 2px;
    animation: fadeOut 2.5s ease-out forwards;
    pointer-events: none;
}

@keyframes fadeOut {
    0% { opacity: 1; }
    70% { opacity: 0.5; }
    100% { opacity: 0; }
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-links {
        margin-top: 0.5rem;
        align-self: flex-start;
    }

    .nav-links a {
        margin-left: 0;
        margin-right: 1rem;
    }
}
