:root {
    --primary-color: #FF9E5E;
    --primary-hover: #FF8842;
    --primary-light: #FFB074;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    padding-bottom: 0;
    padding-top: calc(60px + env(safe-area-inset-top)); /* Space for sticky header + safe area */
    /* Sticky footer layout */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.has-mobile-nav {
    padding-bottom: 70px;
}

/* Sticky Header */
.sticky-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: 60px;
    height: calc(60px + env(safe-area-inset-top));
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    box-shadow: 0 2px 8px rgba(255, 158, 94, 0.3);
    z-index: 9998; /* Below pull-to-refresh indicator */
    display: flex;
    align-items: center;
    justify-content: center;
    /* Extend into safe area on iOS */
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    flex-shrink: 0; /* Don't shrink in flex layout */
}

.sticky-header-content {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-weight: 600;
}

.sticky-header-content i {
    font-size: 28px;
    color: white;
}

.sticky-header-title {
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.sticky-header-subtitle {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.9;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.2);
}

.sticky-header-logo {
    max-height: 48px;
    max-width: 220px;
    object-fit: contain;
    border-radius: 4px;
    padding: 2px 0;
}

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

/* Main content container should grow to push footer down */
body > .container {
    flex: 1 0 auto;
}

/* Navigation */
.navbar {
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
    margin-bottom: 2rem;
    margin-top: 0;
    flex-shrink: 0; /* Don't shrink the navbar in flex layout */
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.navbar-nav {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.navbar-nav a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}

.navbar-nav a:hover {
    color: var(--primary-color);
}

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

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

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

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

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

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

.btn-danger:hover {
    background-color: #c82333;
}

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

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

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

.btn-sm {
    padding: 0.375rem 1rem;
    font-size: 0.9rem;
}

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

.card-header {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--light-color);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.table th {
    background-color: var(--light-color);
    font-weight: 600;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Grid */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* Event Card */
.event-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.event-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.event-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.event-card-title {
    font-size: 1.25rem;
    font-weight: bold;
    color: #333;
}

.event-card-status {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-active {
    background-color: #d4edda;
    color: #155724;
}

.status-inactive {
    background-color: #f8d7da;
    color: #721c24;
}

.event-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* QR Code Display */
.qr-container {
    text-align: center;
    padding: 2rem;
}

.qr-code {
    max-width: 300px;
    margin: 0 auto;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.qr-code img {
    width: 100%;
    height: auto;
}

/* Desktop Navigation Dropdown */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.nav-dropdown-toggle .fa-chevron-down {
    font-size: 0.75rem;
    transition: transform 0.3s;
}

.nav-dropdown.active .fa-chevron-down {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    min-width: 200px;
    list-style: none;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s;
    z-index: 1000;
}

.nav-dropdown.active .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown-menu li {
    padding: 0;
}

.nav-dropdown-menu a {
    display: block;
    padding: 0.75rem 1.25rem;
    color: #333;
    text-decoration: none;
    transition: background-color 0.2s;
}

.nav-dropdown-menu a:hover {
    background-color: #f8f9fa;
    color: var(--primary-color);
}

.nav-dropdown-menu i {
    margin-right: 0.5rem;
    width: 20px;
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 0.5rem 0;
    /* Extend into safe area on iOS */
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 0.4rem 0.2rem;
    text-decoration: none;
    color: #6c757d;
    transition: color 0.3s;
    min-width: 0; /* Allow flex items to shrink below content size */
}

.mobile-nav-item i {
    font-size: 1.3rem;
    margin-bottom: 0.2rem;
}

.mobile-nav-item span {
    font-size: 0.65rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.mobile-nav-item.active,
.mobile-nav-item:hover {
    color: var(--primary-color);
}

/* Adjust for smaller screens */
@media (max-width: 380px) {
    .mobile-nav-item i {
        font-size: 1.2rem;
    }
    
    .mobile-nav-item span {
        font-size: 0.6rem;
    }
}

/* Mobile Submenu */
.mobile-submenu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1100;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
    max-height: 80vh;
    overflow-y: auto;
}

.mobile-submenu.active {
    transform: translateY(0);
}

.mobile-submenu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
}

.mobile-submenu-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #333;
}

.mobile-submenu-header h3 i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

.mobile-submenu-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6c757d;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-submenu-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-submenu-list li a {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #f5f5f5;
    transition: background-color 0.2s;
}

.mobile-submenu-list li:last-child a {
    border-bottom: none;
}

.mobile-submenu-list li a:hover {
    background-color: #f8f9fa;
}

.mobile-submenu-list li a i {
    margin-right: 1rem;
    width: 24px;
    color: var(--primary-color);
    font-size: 1.25rem;
}

/* Mobile Overlay */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Responsive */
@media (max-width: 768px) {
    .desktop-nav {
        display: none;
    }

    .mobile-bottom-nav {
        display: flex;
    }

    body {
        padding-bottom: calc(70px + env(safe-area-inset-bottom));
    }
    
    body.has-mobile-nav {
        padding-bottom: calc(70px + env(safe-area-inset-bottom));
    }

    .container {
        padding-bottom: 1rem;
    }

    .event-card-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .sticky-header-title {
        font-size: 20px;
    }

    .sticky-header-content i {
        font-size: 24px;
    }

    .sticky-header-subtitle {
        font-size: 12px;
    }

    .sticky-header-logo {
        max-height: 46px;
        max-width: 180px;
    }

    /* Optimize event details card for mobile viewport */
    .card {
        padding: 1rem;
        margin-bottom: calc(80px + env(safe-area-inset-bottom));
    }

    .event-card-header {
        margin-bottom: 0.75rem;
    }

    .event-card-title {
        font-size: 1.1rem;
    }

    .event-card-status {
        padding: 0.2rem 0.6rem;
        font-size: 0.75rem;
    }

    .stats-grid {
        gap: 0.75rem;
        margin-bottom: 0;
    }

    .stat-card {
        padding: 1rem;
    }

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

    .stat-label {
        font-size: 0.8rem;
        margin-top: 0.25rem;
    }
}

@media (min-width: 769px) {
    .mobile-bottom-nav,
    .mobile-submenu,
    .mobile-overlay {
        display: none !important;
    }
}

/* Auth Pages */
.auth-container {
    max-width: 450px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.auth-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 2rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: #666;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Customer Form Styling */
.customer-form-container {
    max-width: 600px;
    margin: 1rem auto;
    padding: 0 1rem;
}

.brand-header {
    text-align: center;
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.brand-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.welcome-message {
    background-color: var(--light-color);
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    text-align: center;
}

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

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    color: #666;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

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

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

.text-muted {
    color: #6c757d;
}

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

.text-danger {
    color: var(--danger-color);
}

/* Pull to Refresh - Using Native iOS Behavior */
/* iOS Safari provides native pull-to-refresh automatically */
/* No custom styling needed - removed to prevent conflicts */

/* Sticky FAB Buttons */
.fab-button {
    position: fixed !important; /* Force fixed positioning */
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 9997 !important; /* Just below sticky header */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* iOS Liquid Glass Effect */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    /* Ensure proper rendering on all devices */
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.fab-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.fab-button:active {
    transform: scale(0.95);
}

/* Back FAB - Bottom Left */
.fab-back {
    bottom: calc(90px + env(safe-area-inset-bottom)) !important;
    left: 20px !important;
    background: linear-gradient(135deg, rgba(108, 117, 125, 0.9) 0%, rgba(73, 80, 87, 0.9) 100%);
}

.fab-back:hover {
    background: linear-gradient(135deg, rgba(90, 98, 104, 0.95) 0%, rgba(52, 58, 64, 0.95) 100%);
}

/* Create FAB - Bottom Right */
.fab-create {
    bottom: calc(90px + env(safe-area-inset-bottom));
    right: 20px;
    background: linear-gradient(135deg, rgba(255, 158, 94, 0.9) 0%, rgba(255, 136, 66, 0.9) 100%);
}

.fab-create:hover {
    background: linear-gradient(135deg, rgba(255, 176, 116, 0.95) 0%, rgba(255, 158, 94, 0.95) 100%);
}

.fab-create.active {
    transform: rotate(45deg);
}

/* FAB Create Menu */
.fab-create-menu {
    position: fixed;
    bottom: calc(160px + env(safe-area-inset-bottom));
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(20px);
}

.fab-create-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.fab-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 12px 20px;
    border-radius: 28px;
    text-decoration: none;
    color: #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    /* iOS Liquid Glass Effect */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transform: translateX(100px);
    opacity: 0;
}

.fab-create-menu.active .fab-menu-item {
    transform: translateX(0);
    opacity: 1;
}

.fab-create-menu.active .fab-menu-item:nth-child(1) {
    transition-delay: 0.05s;
}

.fab-create-menu.active .fab-menu-item:nth-child(2) {
    transition-delay: 0.1s;
}

.fab-create-menu.active .fab-menu-item:nth-child(3) {
    transition-delay: 0.15s;
}

.fab-menu-item:hover {
    transform: translateX(-5px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.fab-menu-item i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.fab-menu-item.event i {
    color: var(--primary-color);
}

.fab-menu-item.contact i {
    color: var(--success-color);
}

.fab-menu-item.broadcast i {
    color: #25D366;
}

.fab-menu-item.message i {
    color: #25D366;
}

.fab-menu-item.email i {
    color: #007bff;
}

.fab-menu-item span {
    font-weight: 500;
    font-size: 0.95rem;
}

/* FAB Overlay */
.fab-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 997;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.fab-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Desktop adjustments */
@media (min-width: 769px) {
    .fab-back {
        bottom: 20px;
    }
    
    .fab-create {
        bottom: 20px;
    }
    
    .fab-create-menu {
        bottom: 90px;
    }
}

/* Small mobile screens */
@media (max-width: 380px) {
    .fab-button {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }
    
    .fab-back {
        left: 16px;
    }
    
    .fab-create {
        right: 16px;
    }
    
    .fab-create-menu {
        right: 16px;
    }
    
    .fab-menu-item {
        padding: 10px 16px;
        font-size: 0.875rem;
    }
}

/* Footer Styles */
.footer {
    background-color: #f8f9fa;
    padding: 1rem 0;
    margin-top: auto;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0; /* Don't shrink the footer */
}

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

.footer .row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
    align-items: center;
}

.footer .col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
    padding-right: 15px;
    padding-left: 15px;
}

.footer .text-center {
    text-align: center;
}

.footer .text-muted {
    color: #6c757d;
}

.footer .text-muted a {
    color: #6c757d;
    text-decoration: underline;
}

.footer .text-muted a:hover {
    color: #495057;
}

.footer .badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
}

.footer .badge.bg-primary {
    background-color: #007bff;
}

.footer .badge.bg-success {
    background-color: #28a745;
}

.footer .badge.bg-info {
    background-color: #17a2b8;
}

.footer .me-2 {
    margin-right: 0.5rem;
}

/* Responsive Footer */
@media (max-width: 768px) {
    .footer .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 1rem;
    }
    
    .footer .col-md-6:last-child {
        margin-bottom: 0;
    }
    
    .footer {
        padding: 1.5rem 0;
        /* Account for mobile bottom navigation */
        padding-bottom: calc(1.5rem + 70px + env(safe-area-inset-bottom));
        margin-bottom: 0;
    }
}
