/**
 * BIMACON Registration System - Custom Styles
 * Mobile-first responsive design
 * Primary Color: #366092
 */

/* ==================== CSS VARIABLES ==================== */
:root {
    --primary-color: #366092;
    --primary-dark: #2a4a6f;
    --primary-light: #4a7ab5;
    --secondary-color: #f8f9fa;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --dark-color: #343a40;
    --light-color: #f8f9fa;

    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;

    --transition-speed: 0.3s;
    --border-radius: 0.5rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);

    --min-touch-size: 44px;
}

/* ==================== GLOBAL STYLES ==================== */
* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    background-color: var(--secondary-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==================== CUSTOM SCROLLBAR ==================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--secondary-color);
    border-radius: var(--border-radius);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: var(--border-radius);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ==================== TYPOGRAPHY ==================== */
h1, h2, h3, h4, h5, h6 {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.75rem;
}

h3 {
    font-size: 1.5rem;
}

/* Mobile adjustments */
@media (max-width: 576px) {
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.125rem;
    }
}

/* ==================== BUTTONS ==================== */
.btn {
    min-height: var(--min-touch-size);
    min-width: var(--min-touch-size);
    font-weight: 500;
    border-radius: var(--border-radius);
    transition: all var(--transition-speed) ease;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-lg);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-lg);
}

.btn-lg {
    min-height: 56px;
    font-size: 1.125rem;
    padding: 1rem 2rem;
}

.btn-icon {
    min-width: var(--min-touch-size);
    min-height: var(--min-touch-size);
    padding: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ==================== CARDS ==================== */
.card {
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: 1px solid var(--border-color);
    background: white;
    transition: all var(--transition-speed) ease;
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: var(--box-shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
    padding: 1rem 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    background-color: var(--secondary-color);
    padding: 1rem 1.5rem;
}

/* ==================== STATISTICS CARDS ==================== */
.stat-card {
    border-left: 4px solid var(--primary-color);
    transition: all var(--transition-speed) ease;
    cursor: pointer;
}

.stat-card:hover {
    border-left-width: 8px;
    box-shadow: var(--box-shadow-lg);
}

.stat-card.stat-success {
    border-left-color: var(--success-color);
}

.stat-card.stat-warning {
    border-left-color: var(--warning-color);
}

.stat-card.stat-danger {
    border-left-color: var(--danger-color);
}

.stat-card.stat-info {
    border-left-color: var(--info-color);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 0.5rem;
    animation: countUp 0.8s ease-out;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.stat-icon {
    font-size: 2rem;
    opacity: 0.3;
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==================== BADGES ==================== */
.badge {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--border-radius);
}

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

.badge-delegate-doctor {
    background-color: var(--info-color);
    color: white;
}

.badge-delegate-student {
    background-color: #6c757d;
    color: white;
}

.badge-orgcommittee {
    background-color: #343a40;
    color: white;
}

.badge-service {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.badge-service.active {
    background-color: var(--success-color);
}

.badge-service.inactive {
    background-color: var(--text-secondary);
}

/* ==================== FORMS ==================== */
.form-control,
.form-select {
    min-height: var(--min-touch-size);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: all var(--transition-speed) ease;
    font-size: 1rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(54, 96, 146, 0.25);
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-floating > .form-control {
    min-height: 58px;
}

/* ==================== QR SCANNER OVERLAY ==================== */
#qr-scanner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#qr-scanner-overlay.active {
    display: flex;
}

#reader {
    width: 100%;
    max-width: 500px;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.scanner-header {
    color: white;
    text-align: center;
    margin-bottom: 2rem;
}

.scanner-controls {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* ==================== LOADING SPINNER ==================== */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
}

.spinner-overlay.active {
    display: flex;
}

.spinner-border-custom {
    width: 4rem;
    height: 4rem;
    border: 0.5rem solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    color: white;
    margin-top: 1rem;
    font-size: 1.125rem;
    font-weight: 600;
}

/* ==================== TOAST NOTIFICATIONS ==================== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
}

.toast {
    min-width: 300px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-header {
    background-color: var(--primary-color);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

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

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

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

/* ==================== TABLES ==================== */
.table {
    font-size: 0.95rem;
}

.table thead th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    border: none;
    padding: 1rem;
    white-space: nowrap;
}

.table tbody tr {
    transition: background-color var(--transition-speed) ease;
}

.table tbody tr:hover {
    background-color: rgba(54, 96, 146, 0.05);
}

.table-responsive {
    border-radius: var(--border-radius);
    overflow: hidden;
}

/* Mobile table adjustments */
@media (max-width: 768px) {
    .table {
        font-size: 0.875rem;
    }

    .table thead th,
    .table tbody td {
        padding: 0.75rem 0.5rem;
    }
}

/* ==================== NAVIGATION ==================== */
.navbar {
    box-shadow: var(--box-shadow);
    background-color: var(--primary-color) !important;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

.nav-link {
    min-height: var(--min-touch-size);
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem !important;
    transition: all var(--transition-speed) ease;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

/* ==================== SERVICE BUTTONS ==================== */
.service-btn {
    width: 100%;
    min-height: 60px;
    font-size: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
}

.service-btn i {
    font-size: 1.5rem;
}

.service-btn.completed {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.service-btn.pending {
    background-color: var(--text-secondary);
    border-color: var(--text-secondary);
}

.service-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==================== GUEST DETAILS ==================== */
.guest-info {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--box-shadow);
}

.guest-id-display {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 1rem;
    padding: 1rem;
    background-color: var(--secondary-color);
    border-radius: var(--border-radius);
}

.guest-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.guest-detail-row:last-child {
    border-bottom: none;
}

.guest-detail-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.guest-detail-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* ==================== QR CODE DISPLAY ==================== */
.qr-code-container {
    text-align: center;
    padding: 2rem;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.qr-code-container img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
}

/* ==================== MANUAL ENTRY ==================== */
.manual-entry-container {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: var(--box-shadow);
}

.manual-entry-input {
    font-size: 1.25rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
}

/* ==================== RECENT SCANS ==================== */
.recent-scan-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: all var(--transition-speed) ease;
    cursor: pointer;
}

.recent-scan-item:hover {
    background-color: var(--secondary-color);
}

.recent-scan-item:last-child {
    border-bottom: none;
}

.recent-scan-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ==================== PRINT STYLES ==================== */
@media print {
    body {
        background-color: white;
    }

    .navbar,
    .btn,
    .no-print {
        display: none !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid var(--border-color);
        page-break-inside: avoid;
    }

    .table {
        page-break-inside: avoid;
    }

    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

/* ==================== UTILITY CLASSES ==================== */
.text-primary-custom {
    color: var(--primary-color) !important;
}

.bg-primary-custom {
    background-color: var(--primary-color) !important;
}

.border-primary-custom {
    border-color: var(--primary-color) !important;
}

.cursor-pointer {
    cursor: pointer;
}

.text-uppercase {
    text-transform: uppercase;
}

.letter-spacing {
    letter-spacing: 1px;
}

/* ==================== RESPONSIVE ADJUSTMENTS ==================== */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .stat-value {
        font-size: 2rem;
    }

    .toast-container {
        right: 0.5rem;
        left: 0.5rem;
    }

    .toast {
        min-width: auto;
        width: 100%;
    }
}

/* ==================== ACCESSIBILITY ==================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus,
a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ==================== DARK MODE SUPPORT (Optional) ==================== */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f8f9fa;
        --text-secondary: #adb5bd;
        --secondary-color: #212529;
        --border-color: #495057;
    }

    body {
        background-color: #1a1d20;
        color: var(--text-primary);
    }

    .card {
        background-color: #2d3238;
        border-color: var(--border-color);
    }

    .form-control,
    .form-select {
        background-color: #2d3238;
        color: var(--text-primary);
        border-color: var(--border-color);
    }
}

/* ==================== VIBRATION FEEDBACK ==================== */
.vibrate-on-scan {
    /* Visual feedback for devices without vibration */
    animation: pulse 0.3s ease-in-out;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ==================== CUSTOM PROGRESS BAR ==================== */
.progress {
    height: 1.5rem;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.progress-bar {
    background-color: var(--primary-color);
    transition: width 0.6s ease;
}

/* ==================== MODAL ENHANCEMENTS ==================== */
.modal-content {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--box-shadow-lg);
}

.modal-header {
    background-color: var(--primary-color);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-header .btn-close {
    filter: invert(1);
}

/* ==================== EMPTY STATES ==================== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-state h4 {
    color: var(--text-secondary);
}

/* ==================== FOOTER ==================== */
.footer {
    background-color: var(--primary-color);
    color: white;
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer a {
    color: white;
    text-decoration: none;
    transition: opacity var(--transition-speed) ease;
}

.footer a:hover {
    opacity: 0.8;
}
