/* Mobile-First Responsive Styles */

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

:root {
    --primary-color: #4a90d9;
    --primary-dark: #357abd;
    --danger-color: #dc3545;
    --danger-dark: #c82333;
    --success-color: #28a745;
    --gray-light: #f5f5f5;
    --gray-medium: #ddd;
    --gray-dark: #666;
    --text-color: #333;
    --white: #fff;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--gray-light);
    color: var(--text-color);
    line-height: 1.5;
    min-height: 100vh;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.login-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-medium);
    border-radius: var(--radius);
    font-size: 16px;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.2);
}

.error-message {
    background: #fee;
    color: var(--danger-color);
    padding: 10px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    text-align: center;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    text-decoration: none;
    text-align: center;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--gray-medium);
    color: var(--text-color);
}

.btn-secondary:hover {
    background-color: #ccc;
}

.btn-danger {
    background-color: var(--danger-color);
    color: var(--white);
}

.btn-danger:hover {
    background-color: var(--danger-dark);
}

.btn-block {
    display: block;
    width: 100%;
}

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

/* Header */
.header {
    background: var(--primary-color);
    color: var(--white);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    flex: 1;
    font-size: 20px;
    font-weight: 600;
}

.user-badge {
    font-size: 14px;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 12px;
    border-radius: 20px;
}

/* Hamburger Menu */
.hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--white);
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Navigation */
.nav {
    background: var(--white);
    box-shadow: var(--shadow);
    display: none;
    flex-direction: column;
}

.nav.open {
    display: flex;
}

.nav-item {
    padding: 15px 20px;
    text-decoration: none;
    color: var(--text-color);
    border-bottom: 1px solid var(--gray-light);
    transition: background-color 0.2s;
}

.nav-item:hover {
    background-color: var(--gray-light);
}

.nav-item.active {
    background-color: var(--gray-light);
    color: var(--primary-color);
    font-weight: 600;
    border-left: 4px solid var(--primary-color);
}

.nav-logout {
    color: var(--danger-color);
}

/* Main Content */
.main-content {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-header h2 {
    font-size: 24px;
}

/* Filter Bar */
.filter-bar {
    background: var(--white);
    padding: 15px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.filter-bar label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.filter-bar select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--gray-medium);
    border-radius: var(--radius);
    font-size: 16px;
    background: var(--white);
}

/* List Items */
.list-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.list-item {
    background: var(--white);
    padding: 15px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-weight: 600;
    font-size: 16px;
    word-break: break-word;
}

.list-item-subtitle {
    font-size: 14px;
    color: var(--gray-dark);
    margin-top: 4px;
}

.list-item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-dark);
}

.loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-dark);
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--gray-light);
}

.modal-header h3 {
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-dark);
    padding: 0;
    line-height: 1;
}

.modal-body {
    padding: 20px;
}

.modal-body .form-group {
    margin-bottom: 20px;
}

.modal-body .form-group:last-child {
    margin-bottom: 0;
}

.modal-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.modal-body input,
.modal-body select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-medium);
    border-radius: var(--radius);
    font-size: 16px;
}

.modal-body input:focus,
.modal-body select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.2);
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid var(--gray-light);
    justify-content: flex-end;
}

.modal-confirm .modal-body {
    text-align: center;
    font-size: 16px;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-color);
    color: var(--white);
    padding: 12px 24px;
    border-radius: var(--radius);
    z-index: 300;
    animation: slideUp 0.3s ease;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Section Titles */
.section-title {
    font-size: 18px;
    font-weight: 600;
    margin: 25px 0 15px 0;
    color: var(--text-color);
}

.section-title:first-of-type {
    margin-top: 0;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-info {
    background: var(--gray-light);
    color: var(--gray-dark);
}

/* Ticket List in Modal */
.ticket-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.ticket-item {
    background: var(--gray-light);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.ticket-item.ticket-invalid {
    opacity: 0.6;
}

.ticket-info {
    flex: 1;
    min-width: 0;
}

.ticket-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.ticket-meta {
    font-size: 12px;
    color: var(--gray-dark);
}

.ticket-status {
    font-size: 12px;
    font-weight: 500;
    margin-top: 4px;
}

.status-active {
    color: var(--success-color);
}

.status-exhausted,
.status-expired {
    color: var(--danger-color);
}

.status-invalid {
    color: var(--gray-dark);
}

.ticket-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--gray-light);
}

/* NFC Styles */
.btn-nfc {
    background-color: #9c27b0;
    color: var(--white);
}

.btn-nfc:hover {
    background-color: #7b1fa2;
}

.btn-warning {
    background-color: #ff9800;
    color: var(--white);
}

.btn-warning:hover {
    background-color: #f57c00;
}

.btn-header {
    padding: 8px 12px;
    font-size: 14px;
    margin-right: 10px;
}

.nfc-badge {
    display: inline-block;
    background: #9c27b0;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 6px;
    vertical-align: middle;
    font-weight: 600;
}

.nfc-status {
    text-align: center;
    padding: 20px 0;
}

.nfc-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--gray-light);
    color: var(--gray-dark);
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 15px;
}

.nfc-icon.nfc-assigned {
    background: #9c27b0;
    color: white;
}

.nfc-status p {
    color: var(--gray-dark);
    margin: 0;
}

.nfc-scan-status {
    margin-top: 20px;
    padding: 15px;
    border-radius: var(--radius);
    text-align: center;
}

.nfc-scanning {
    color: var(--primary-color);
    animation: pulse 1.5s infinite;
}

.nfc-error {
    color: var(--danger-color);
}

.nfc-success {
    color: var(--success-color);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.nfc-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

/* Check Page Styles */
.main-content-check {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 120px);
    padding: 20px;
}

.check-container {
    text-align: center;
    width: 100%;
    max-width: 400px;
}

.check-animation {
    margin-bottom: 30px;
}

.check-circle {
    position: relative;
    display: inline-block;
    width: 150px;
    height: 150px;
}

.check-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #9c27b0, #673ab7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    font-weight: 700;
    z-index: 2;
}

.check-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border: 3px solid #9c27b0;
    border-radius: 50%;
    animation: checkPulse 2s ease-out infinite;
}

.check-pulse-2 {
    animation-delay: 1s;
}

@keyframes checkPulse {
    0% {
        width: 100px;
        height: 100px;
        opacity: 1;
    }
    100% {
        width: 180px;
        height: 180px;
        opacity: 0;
    }
}

.check-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 10px;
}

.check-subtitle {
    font-size: 16px;
    color: var(--gray-dark);
    animation: pulse 1.5s infinite;
}

.check-nfc-error {
    margin-top: 20px;
    padding: 15px;
    background: #fee;
    color: var(--danger-color);
    border-radius: var(--radius);
}

/* Check Result Overlay */
.check-result-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 500;
    justify-content: center;
    align-items: center;
}

.check-result-overlay.open {
    display: flex;
}

.check-result {
    text-align: center;
    padding: 40px;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    animation: resultPop 0.3s ease;
}

@keyframes resultPop {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.result-okay {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.result-restricted {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
}

.result-confirm {
    background: linear-gradient(135deg, #ff9800, #ffc107);
}

.check-result-icon {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    color: white;
    margin: 0 auto 20px;
}

.check-result-title {
    font-size: 36px;
    font-weight: 700;
    color: white;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.check-result-name {
    font-size: 24px;
    font-weight: 600;
    color: white;
    margin-bottom: 10px;
}

.check-result-group {
    display: block;
    font-size: 16px;
    font-weight: 400;
    opacity: 0.85;
    margin-top: 4px;
}

.check-result-info {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
}

.check-result-actions {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.btn-success:hover {
    background-color: #218838;
}

.btn-large {
    padding: 15px 30px;
    font-size: 18px;
}

.text-okay {
    color: white;
}

.text-restricted {
    color: white;
}

.text-confirm {
    color: white;
}

/* Desktop Styles */
@media (min-width: 768px) {
    .hamburger {
        display: none;
    }

    .nav {
        display: flex;
        flex-direction: row;
        justify-content: center;
        gap: 10px;
        padding: 10px;
    }

    .nav-item {
        padding: 10px 20px;
        border: none;
        border-radius: var(--radius);
    }

    .nav-item.active {
        border-left: none;
    }

    .main-content {
        padding: 30px;
    }

    .list-item {
        padding: 20px;
    }

    .modal {
        max-width: 500px;
    }
}
