:root {
    --primary-color: #3d8bfd; --primary-gradient: linear-gradient(to right, #4facfe, #00f2fe);
    --text-color: #333; --label-color: #555; --border-color: #d1d5db; --background-color: #f4f7f6;
    --form-background: #ffffff; --highlight-red: #d92626; --font-family: 'Poppins', sans-serif;
    --success-color: #10b981;
  }
    /* Dark mode variables activated when body.dark-mode is present */
    body.dark-mode {
        --text-color: #e5e7eb;
        --label-color: #d1d5db;
        --border-color: #374151;
        --background-color: #0b1220;
        --form-background: #0f1724;
        --highlight-red: #f87171;
        --primary-color: #60a5fa;
        --primary-gradient: linear-gradient(to right, #4f46e5, #06b6d4);
        --success-color: #34d399;
    }
  body { 
    font-family: var(--font-family); margin: 0; padding: 20px; background-color: var(--background-color);
    background-image: url('https://i.imgur.com/m6OiUGP.png');
    background-size: cover; background-position: center; background-attachment: fixed; 
    font-size: 16px; color: var(--text-color); transition: background-image 0.4s ease-in-out; 
    padding-bottom: 80px;
  }

  /* Floating global theme toggle (icon-only) */
  .global-theme-toggle {
    position: fixed;
    right: 16px;
    top: 12px;
    z-index: 1500;
  }
  .icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  }
  .icon-button.circle { border-radius: 50%; }
  .icon-button:hover { filter: brightness(0.98); }

  /* Notifications UI */
  .notif-wrap { position: relative; margin-left: auto; margin-right: 8px; }
  .notif-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: #ef4444;
    color: white;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
  }
  .notif-badge.hidden { display: none; }
  .notif-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
  }
  .notif-overlay.hidden { display: none; }
  .notif-panel {
    width: 480px;
    max-width: calc(100% - 32px);
    background: var(--form-background);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(0,0,0,0.25);
    padding: 12px;
  }
  .notif-header { display:flex; justify-content: space-between; align-items:center; padding: 6px 4px 8px; border-bottom:1px solid var(--border-color); margin-bottom:6px; }
  .notif-list { list-style: none; padding: 0; margin: 0; max-height: 300px; overflow: auto; }
  .notif-item { display:flex; justify-content: space-between; align-items:flex-start; gap: 8px; padding: 8px 6px; border-radius: 8px; }
  .notif-item:hover { background: var(--input-bg); }
  .notif-sub { color: var(--label-color); font-size: 12px; }
  .notif-empty { padding: 12px; color: var(--label-color); }
  .link-button { background: none; border: none; color: #6366f1; cursor: pointer; padding: 0; }

  /* Announcement header spacing */
  #announcement-header { color: var(--label-color); }

  /* Admin badge */
  .admin-badge { margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: linear-gradient(90deg,#6366f1,#4f46e5); color: #fff; font-size: 12px; font-weight: 600; }

  /* Help & FAQ */
  .help-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 10px; }
  .help-card { background: var(--form-background); border:1px solid var(--border-color); border-radius: 12px; padding: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
  .help-card.emphasis { border-color: #6366f1; }
  .accordion { width:100%; background:none; border:none; color: var(--text-color); font-weight:600; display:flex; align-items:center; justify-content:space-between; padding: 10px 6px; cursor:pointer; }
  .accordion:hover { background: var(--input-bg); border-radius: 8px; }
  .acc-icon { color: var(--label-color); }
  .accordion-panel { padding: 8px 6px 4px; color: var(--label-color); }

  /* Confirmation Modal */
  .confirm-overlay { position: fixed; inset: 0; z-index: 3000; display: none; }
  .confirm-overlay:not(.hidden) { display: flex; align-items: center; justify-content: center; }
  .confirm-backdrop, .confirm-overlay .modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.7); }
  .confirm-panel { position: relative; z-index: 1; background: var(--form-background); color: var(--text-color); border:1px solid var(--border-color); border-radius: 12px; width: min(720px, 95%); max-height: 80vh; overflow:auto; padding: 16px; box-shadow: 0 20px 50px rgba(0,0,0,0.4); }
  .confirm-body > div { padding: 8px 0; border-bottom: 1px dashed var(--border-color); }
  .confirm-actions { display:flex; justify-content: flex-end; gap: 10px; padding-top: 12px; }
  
/* Theme Banner */
.theme-banner { position:relative; border-radius:12px; overflow:hidden; margin-bottom:18px; color:#fff; }
.theme-banner-bg { position:absolute; inset:0; background:#374151; filter:brightness(.9); }
.theme-banner-content { position:relative; padding:32px 24px; }
.theme-banner h2 { margin:0 0 4px; font-size:1.6rem; }
.theme-banner.hidden { display:none; }

/* Read-only Banner */
.readonly-banner {
  background: #f87171;
  color: white;
  text-align: center;
  padding: 10px;
  margin: 0 0 20px;
  border-radius: 8px;
  font-weight: 600;
}
body.dark-mode .readonly-banner {
  background: #7f1d1d;
}

/* Help popover */
.help-icon { display:inline-block; background:#6366f1; color:#fff; width:18px; height:18px; line-height:18px; text-align:center; border-radius:50%; font-size:12px; cursor:pointer; margin-left:4px; }
.help-popover { position:absolute; max-width:260px; background:#111827; color:#f9fafb; padding:10px 12px; border-radius:8px; font-size:.78rem; z-index:9999; box-shadow:0 4px 16px -2px rgba(0,0,0,.35); }

/* Skeletons */
.skeleton { background: linear-gradient(90deg,#e5e7eb 25%,#f3f4f6 37%,#e5e7eb 63%); background-size:400% 100%; animation: shimmer 1.2s ease-in-out infinite; color:transparent !important; }
@keyframes shimmer { 0% { background-position:100% 0 } 100% { background-position:0 0 } }

/* Virtualized list */
.virtualized-list { position:relative; overflow:auto; max-height:520px; border:1px solid var(--border-color); border-radius:8px; padding:0 0 4px; }
.virtualized-list .submission-card { margin:4px 8px; }
.virtual-viewport { position:relative; }

/* Empty state */
.empty-state { padding:32px; text-align:center; color:var(--label-color); }

  .wrapper {
    max-width: 750px; margin: 40px auto; background-color: var(--form-background); 
    padding: 30px 40px; border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border-top: 5px solid var(--primary-color);
  }
  .edit-timestamp {
    text-align: center;
    color: #666;
    font-size: 0.9em;
    margin: -15px 0 20px 0;
    font-style: italic;
  }
  h1 { font-size: 1.8em; font-weight: 700; text-align: center; margin-bottom: 25px; }
  h2 { font-size: 1.3em; font-weight: 600; text-align: left; margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px solid #eee;}
  label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--label-color); font-size: 0.95em; }
  /* On-blur validation states */
  .input-valid { outline: 2px solid var(--success-color); outline-offset: 1px; }
  .input-invalid { outline: 2px solid #ef4444; outline-offset: 1px; }
  .label-valid { color: var(--success-color) !important; }
  .label-invalid { color: #ef4444 !important; }
    input, select, textarea { 
        width: 100%; padding: 12px; margin-bottom: 20px; border-radius: 8px; border: 1px solid var(--border-color); 
        box-sizing: border-box; font-size: 1em; font-family: var(--font-family); background: var(--form-background); color: var(--text-color);
    }
    /* Make readonly/disabled inputs use theme-aware colors so dark mode remains readable */
    input[readonly], select[disabled] {
        background-color: var(--form-background);
        color: var(--text-color);
        border-color: var(--border-color);
        cursor: not-allowed;
        opacity: 0.95;
    }
    input:disabled, select:disabled, textarea:disabled, .radio-label:has(input:disabled) {
            background-color: rgba(0,0,0,0.03);
            color: var(--text-color);
            cursor: not-allowed;
            opacity: 0.8;
    }
  .action-button, .login-button { padding: 15px; font-size: 1.2em; font-weight: 600; background: var(--primary-gradient); border: none; color: white; border-radius: 8px; cursor: pointer; width: 100%; margin-top: 10px; text-align: center; text-decoration: none; display: inline-block; }
  .action-button:disabled { background: #999; cursor: not-allowed; }
    /* Compact square paste icon style */
    .action-button.paste { width: 40px; height: 40px; padding: 6px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; }
    .action-button.paste svg { width: 18px; height: 18px; }
    /* Tiny success badge animation for paste */
    .paste-success { position: absolute; right: 46px; top: -6px; background: var(--success-color); color: white; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; transform: scale(0); opacity: 0; transition: transform 240ms cubic-bezier(.2,.9,.2,1), opacity 240ms; box-shadow: 0 4px 10px rgba(0,0,0,0.12); }
    .paste-success.show { transform: scale(1); opacity: 1; }
    .info-section { 
        padding: 20px; margin: 25px 0; border-radius: 8px; font-size: 0.9em; background: rgba(255,255,255,0.02);
        line-height: 1.7; 
    }
    #eventInfoSection { background: rgba(99,102,241,0.06); border-left: 5px solid #6366f1; text-align: center; }
    #remindersSection { background: rgba(245,158,11,0.06); border-left: 5px solid #f59e0b; }
    #notesSection { background: rgba(56,189,248,0.04); border-left: 5px solid #38bdf8; }
  .info-section ul { padding-left: 0; margin: 0; list-style: none; }
  .info-section li { display: flex; align-items: flex-start; margin-bottom: 10px; }
  .info-section li svg { flex-shrink: 0; width: 20px; height: 20px; margin-right: 12px; margin-top: 3px; }
  
  .reminders-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
      gap: 15px;
      margin-top: 15px;
  }
  .reminder-item {
      display: flex;
      align-items: flex-start;
      gap: 12px;
  }
  .reminder-icon {
      flex-shrink: 0;
      width: 24px;
      height: 24px;
      color: var(--primary-color);
  }
  .reminder-text {
    font-size: 1.0em;
    line-height: 1.65;
  }

  .info-section .dynamic-text { font-weight: 600; text-align: center; margin-top: 20px; padding-top: 20px; border-top: 1px solid #fde68a; }
  
  .countdown-container {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 10px;
      text-align: center;
      margin-top: 20px;
      padding: 15px;
      border-radius: 8px;
      background-color: #f3f4f6;
  }
  body.dark-mode .countdown-container {
      background-color: #1f2937;
  }
  .countdown-item {
      padding: 10px;
      border-radius: 5px;
      background-color: #ffffff;
  }
  body.dark-mode .countdown-item {
      background-color: #374151;
  }
  .countdown-item span {
      display: block;
      font-size: 2em;
      font-weight: 700;
      color: var(--primary-color);
  }

  .countdown.deadline-critical {
    animation: pulse-critical 1.5s infinite;
  }
  @keyframes pulse-critical {
    0%, 100% { background-color: #fee2e2; border-color: var(--highlight-red); }
    50% { background-color: #fecaca; }
  }
  .countdown.deadline-warning {
    background-color: #fef3c7;
    border-color: #f59e0b;
    color: #b45309;
    animation: none; /* No pulse for warning */
  }
  .countdown.deadline-safe {
    background-color: #dcfce7;
    border-color: #16a34a;
    color: #15803d;
    animation: none; /* No pulse for safe */
  }

  .highlight-red { color: var(--highlight-red); font-weight: 700; }
  .input-container { position: relative; }
    #uidDropdown { position: absolute; top: 100%; left: 0; right: 0; border: 1px solid var(--border-color); max-height: 160px; overflow-y: auto; background: var(--form-background); z-index: 1000; box-shadow: 0 8px 16px rgba(0,0,0,0.06); border-radius: 0 0 8px 8px; }
    #uidDropdown div { padding: 10px 15px; cursor: pointer; color: var(--text-color); }
    #uidDropdown div:hover { background-color: rgba(99,102,241,0.06); }
  .loader-container { display: flex; justify-content: center; align-items: center; padding: 20px; font-weight: 600; color: #888; }
  .spinner { width: 24px; height: 24px; border: 4px solid #f3f3f3; border-top: 4px solid var(--primary-color); border-radius: 50%; animation: spin 1s linear infinite; margin-right: 15px; }
  @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
  .hidden { display: none !important; }
  .error-message { text-align: center; color: var(--highlight-red); background-color: #fee2e2; padding: 15px; border-radius: 8px; border: 1px solid var(--highlight-red); }
  .radio-group { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
  .radio-label { display: inline-flex; align-items: center; padding: 12px 18px; border: 1px solid var(--border-color); border-radius: 50px; cursor: pointer; transition: all 0.2s ease-in-out; }
    .radio-label { color: var(--text-color); background: transparent; }
    .radio-label:hover { border-color: var(--primary-color); background-color: rgba(99,102,241,0.06); }
    .radio-label input { width: auto; margin: 0 10px 0 0; }
    .radio-label:has(input:checked) { background-color: rgba(99,102,241,0.12); border-color: var(--primary-color); font-weight: 600; }
  #clock-widget { 
    position: fixed; bottom: 0; left: 0; width: 100%; 
    background-color: rgba(0, 0, 0, 0.8); /* Dark, semi-transparent background */
    color: white; padding: 8px 0; text-align: center; 
  font-size: 0.95em; /* Slightly larger font */
    font-family: var(--font-family); /* Use main font for readability */
    z-index: 1001; box-shadow: 0 -2px 10px rgba(0,0,0,0.3); 
    display: flex; justify-content: space-around; align-items: center; flex-wrap: wrap;
    -webkit-font-smoothing: antialiased; /* Smoother text rendering */
    text-rendering: optimizeLegibility;
    backdrop-filter: blur(4px); /* Frosted glass effect */
  }
  .clock-item { padding: 0 10px; }
    .clock-time { font-size: 1.05em; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,0.6); }
    .clock-label { font-size: 0.85em; color: #e5e7eb; text-shadow: 0 1px 1px rgba(0,0,0,0.5); }
    @media (max-width: 600px) { 
        #clock-widget { flex-direction: column; padding: 10px 0; } 
        .clock-item { padding: 4px 10px; } 
    }
    /* Mobile-friendly adjustments for clock */
  @media (max-width: 480px) {
    #clock-widget {
      position: static;
      box-shadow: none;
      padding: 12px;
      border-radius: 10px;
      background-color: rgba(0,0,0,0.75); /* Stronger contrast for readability */
      color: #ffffff;
      margin-top: 15px;
      backdrop-filter: none; /* Remove blur on static widget */
    }
    .clock-item {
      width: 100%;
      padding: 10px 0;
      border-top: 1px solid rgba(255,255,255,0.08);
    }
    .clock-item:first-child {
      border-top: none;
    }
    .clock-time { font-size: 1.2em; }
    .clock-label { font-size: 0.95em; color: #f3f4f6; }
    body.dark-mode #clock-widget { background-color: rgba(0,0,0,0.85); }
  }

  /* Dark-mode override for error messages for proper contrast */
  body.dark-mode .error-message { color: #fecaca; background-color: #7f1d1d; border-color: #dc2626; }
    .user-info { display:flex; align-items:center; justify-content:flex-end; gap:12px; margin-bottom: 20px; font-size: 0.9em; }
    .user-info span { font-weight: 600; }
    .user-info a { color: var(--primary-color); cursor: pointer; text-decoration: none; margin-left: 10px; }
    .user-info a:hover { text-decoration: underline; }
    /* Ensure readable in dark mode: give user-info a themed background and proper text colors */
    body.dark-mode .user-info { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.04); padding: 8px 12px; border-radius: 8px; }
    body.dark-mode .user-info .user-email { color: var(--text-color); opacity: 0.95; }

    .form-header {
        position: sticky;
        top: 0;
        background-color: var(--form-background);
        z-index: 10;
        padding: 10px 0;
        margin-bottom: 10px;
        border-bottom: 1px solid var(--border-color);
        text-align: center;
        font-weight: 600;
        font-size: 1.2em;
    }

    /* Smooth view transitions */
    .view-transition { opacity: 0; transform: translateY(6px); transition: opacity 220ms ease, transform 220ms ease; }
    .view-visible { opacity: 1; transform: translateY(0); }
    /* Theme toggle styles */
    .theme-switch-wrapper { display: inline-flex; align-items: center; gap: 8px; margin-right: 12px; }
    .theme-switch { display:inline-block; width:44px; height:24px; position:relative; }
    .theme-switch input { display:none; }
    .theme-switch .slider { position:absolute; inset:0; background:#cbd5e1; border-radius:24px; transition:0.2s; }
    .theme-switch .slider:before { content:''; position:absolute; left:4px; top:4px; width:16px; height:16px; background:white; border-radius:50%; transition:0.2s; }
    .theme-switch input:checked + .slider { background: var(--primary-color); }
    .theme-switch input:checked + .slider:before { transform: translateX(20px); }
  .dashboard-actions { display: flex; flex-direction: column; gap: 15px; margin-top: 20px; }
  #dashboard-content p { text-align: center; }
  #submissions-table { width: 100%; border-collapse: collapse; margin-top: 20px; }
  #submissions-table th, #submissions-table td { border: 1px solid var(--border-color); padding: 12px; text-align: left; }
    #submissions-table th { background-color: rgba(0,0,0,0.04); font-weight: 600; color: var(--text-color); }
  .back-button { margin-bottom: 20px; }
  .creator-credit { text-align: center; margin-top: 30px; font-size: 0.8em; color: #999; }
  #mainContent > label[for="eventSelect"] {
    display: block;
    text-align: center;
    margin-bottom: 8px;
  }
  #mainContent > select#eventSelect {
    display: block; 
    width: 60%;     
    min-width: 300px; 
    margin: 0 auto 20px auto;
    border: none;
    border-bottom: 2px solid var(--primary-color);
    border-radius: 0;
    padding: 12px 8px;
    background-image: linear-gradient(45deg, transparent 50%, var(--primary-color) 50%),
                     linear-gradient(135deg, var(--primary-color) 50%, transparent 50%);
    background-position: calc(100% - 20px) calc(1em + 2px),
                         calc(100% - 15px) calc(1em + 2px);
    background-size: 5px 5px,
                    5px 5px;
    background-repeat: no-repeat;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    text-align: center;
  }

  .time-input-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 20px;
  }

  .time-input-container input[type="text"] {
    width: 100%;
    margin-bottom: 0;
  }

  .time-input-container input[type="range"] {
    flex: 3;
    margin-bottom: 0;
  }

  .time-section {
    display: flex;
    gap: 10px;
    align-items: center;
  }

  .time-section input[type="number"] {
    width: 60px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-align: center;
  }

  .time-section span {
    font-weight: 600;
    color: var(--label-color);
  }
    /* Submissions cards for mobile */
    .submissions-cards { display: grid; gap: 12px; }
    .submission-card { background: var(--form-background); border: 1px solid var(--border-color); padding: 12px; border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,0.04); }
    .submission-card .card-row { margin-bottom: 8px; }
    .submission-card .card-actions { display:flex; justify-content:flex-end; }
        @media (max-width: 480px) {
            .submission-card { padding: 10px; }
            .submission-card .card-actions { justify-content: center; }
            #submissionsPager { justify-content: center; gap:6px; }
            #submissionsPager button { padding:8px 10px; }
        }
    @media (max-width: 720px) {
        #submissions-table { display: none; }
        .submissions-cards { grid-template-columns: 1fr; }
    }
  .filter-buttons { 
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
  }
  .filter-buttons button {
    padding: 10px 20px;
    font-size: 0.9em;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background-color: #fff;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  .filter-buttons button.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
  }

  .stat-card {
    background: var(--form-background);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    text-align: center;
  }

  /* My Submissions controls */
  .submissions-controls {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    flex-wrap:wrap;
    margin: 10px auto 16px;
    max-width: 980px;
  }
  .submissions-controls .search-box { flex: 1 1 280px; display:flex; justify-content:flex-end; }
  .submissions-controls .search-box input[type="search"] {
    width:100%; max-width:360px; padding:10px 12px; border:1px solid var(--border-color); border-radius:8px;
  }
  .per-page-box { display:flex; align-items:center; gap:8px; }
  .per-page-box label { font-size:0.9em; color:var(--label-color); }
  .per-page-box select { padding:8px; border-radius:8px; border:1px solid var(--border-color); }

  .status-banner {
    border:1px solid transparent; padding:10px 14px; border-radius:10px; margin: 0 auto 14px; max-width:980px;
    text-align:center; font-weight:600;
  }
  .submissions-outer { display:flex; justify-content:center; }
  #submissions-list-container.submissions-cards { 
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    max-width: 980px; width:100%;
  }
  .type-badge {
    display:inline-block; padding:4px 10px; border-radius:999px; font-size:0.8em; font-weight:700;
  }
  .pager { display:flex; align-items:center; justify-content:center; gap:10px; margin-top:16px; }
  .pager .pager-info { color: var(--label-color); }
  .stat-card h4 {
    margin: 0 0 10px;
    font-size: 1em;
    color: var(--label-color);
  }
  .stat-card p {
    margin: 0;
    font-size: 1.8em;
    font-weight: 600;
  }

  /* Form validation feedback */
  .input-feedback {
    font-size: 0.85em;
    margin-top: -15px;
    margin-bottom: 15px;
    display: none;
  }
  .input-feedback.error {
    color: var(--highlight-red);
    display: block;
  }
  .input-feedback.success {
    color: var(--success-color);
    display: block;
  }
  .input-valid {
    border-color: var(--success-color) !important;
  }
  .input-invalid {
    border-color: var(--highlight-red) !important;
  }

  /* Loading overlay */
  .loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
  }
  .loading-content {
    background: var(--form-background);
    padding: 20px 40px;
    border-radius: 12px;
    text-align: center;
    border-left: 6px solid var(--primary-color);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
  }
  .loading-content.success { border-left-color: var(--success-color); }
  .loading-content.error { border-left-color: var(--highlight-red); }
  .loading-content.info { border-left-color: var(--primary-color); }
  .loading-content .loading-message { margin-top:8px; font-weight:600; }
  .spinner { width: 24px; height: 24px; border: 4px solid #f3f3f3; border-top: 4px solid var(--primary-color); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 0 12px 0; }
  .pulse {
    animation: pulse 1.5s infinite;
  }
  @keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
  }
  @keyframes spin { from { transform: rotate(0deg);} to { transform: rotate(360deg);} }

  /* Toast notifications */
  #toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .toast {
    background: var(--form-background);
    color: var(--text-color);
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease-out, fadeOut 0.5s ease-in 4.5s forwards;
    border-left: 5px solid;
  }
  .toast.success {
    border-left-color: var(--success-color);
  }
  .toast.error {
    border-left-color: var(--highlight-red);
  }
  .toast.info {
    border-left-color: var(--primary-color);
  }
  @keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
  }
  @keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; transform: scale(0.9); }
  }

  /* Mobile responsiveness improvements */
  @media (max-width: 768px) {
    .wrapper {
      padding: 20px;
      margin: 20px 10px;
      width: auto;
    }

    /* Table improvements */
    #submissions-table {
      display: block;
      width: 100%;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
    }
    #submissions-table th,
    #submissions-table td {
      min-width: 120px;
      white-space: nowrap;
    }
    #submissions-table .action-button {
      padding: 10px 15px;
      font-size: 1em;
      min-width: 80px;
    }

    /* Filter buttons */
    .filter-buttons {
      flex-wrap: wrap;
      justify-content: center;
    }
    .filter-buttons button {
      flex: 1 1 auto;
      min-width: 120px;
      margin: 5px;
    }

    /* User info improvements */
    .user-info {
      text-align: center;
      margin: 10px 0 20px;
      .per-page-box, .month-filter-box {
        display:flex;
        align-items:center;
        gap:6px;
      }
      .per-page-box select, .month-filter-box select {
        padding:6px 8px;
        border:1px solid var(--border-color);
        border-radius:8px;
        background: var(--form-background);
        color: var(--text-color);
      }
      border-radius: 8px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .user-info span {
      display: block;
      word-break: break-all;
    }
    .user-info a {
      display: inline-block;
      margin: 5px 0 0;
      padding: 8px 15px;
      background: var(--primary-color);
      color: white !important;
      border-radius: 20px;
      text-decoration: none;
    }
    .user-info a:hover {
      background: #2d6cdd;
      text-decoration: none;
    }

    /* Form improvements */
    #mainContent > select#eventSelect {
      width: 100%;
      min-width: unset;
    }
    .radio-group {
      justify-content: center;
    }
    .radio-label {
      flex: 1 1 100%;
      justify-content: center;
    }

    /* Clock widget */
    #clock-widget {
      padding: 15px 10px;
    }
    .clock-item {
      width: 100%;
      text-align: center;
      padding: 5px 0;
    }

    /* Back button */
    .back-button {
      margin-bottom: 15px;
      padding: 12px;
      font-size: 1em;
    }

    /* Submissions controls mobile */
    .submissions-controls { justify-content:center; gap:10px; }
    .submissions-controls .search-box { justify-content:center; }
    #submissions-list-container.submissions-cards { max-width: 100%; }
  }

  /* Small screen improvements */
  @media (max-width: 480px) {
    body {
      padding: 10px;
    }
    .wrapper {
      padding: 15px;
      margin: 10px 5px;
    }
    h1 {
      font-size: 1.5em;
    }
    .radio-label {
      padding: 10px;
      font-size: 0.9em;
    }
    input, select, textarea {
      margin-bottom: 15px;
      padding: 10px;
    }
    .action-button, 
    .login-button {
      padding: 12px;
      font-size: 1.1em;
    }
    /* Larger reminder & notes text for readability */
    .reminder-text { font-size: 1.12em; line-height:1.7; }
        /* Mobile: reduce space and ensure paste buttons don't overflow */
        .action-button { min-height: 40px; }
        .user-info { flex-direction: column; align-items: flex-start; gap:6px; }
        #mainContent > select#eventSelect { width: 100%; }
        .input-container { width:100%; }
        .time-section input[type="number"] { min-width:44px; }

  .status-banner { margin: 0 auto 10px; }
  }

  /* Welcome styling */
  #dashboard-welcome { font-size: 1.1em; }
  .welcome-name { color: var(--primary-color); font-weight: 700; }

  /* Upcoming deadlines */
  #upcoming-deadlines { margin-top: 14px; }
  #upcoming-deadlines .section-title { margin: 0; font-size:1.02em; color: var(--label-color); }
  #upcoming-deadlines .deadline-header { display:flex; align-items:center; justify-content:space-between; margin:0 0 8px; gap:10px; flex-wrap:wrap; }
  .deadline-toggle { display:inline-flex; background: var(--form-background); border:1px solid var(--border-color); border-radius:8px; padding:3px; }
  .deadline-toggle .toggle-btn { border:none; background:transparent; padding:6px 10px; border-radius:6px; color: var(--text-color); cursor:pointer; font-size:0.9em; }
  .deadline-toggle .toggle-btn.active { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border-color); }
  .deadlines-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap:10px; }
  .deadline-card { background: var(--form-background); border:1px solid var(--border-color); border-radius:10px; padding:12px; box-shadow: 0 6px 18px rgba(0,0,0,0.04); }
  .deadline-card.empty { text-align:center; color: var(--label-color); font-style: italic; }
  .deadline-title { font-weight:700; margin-bottom:6px; }
  .deadline-date { color: var(--label-color); font-size:0.95em; }

            /* Paste button: action-button visual but compact when used next to inputs */
            .action-button.paste {
                    padding: 6px;
                    font-size: 0.95em;
                    min-width: 40px;
                    width: 40px;
                    height: 40px;
                    display: inline-flex;
                    align-items: center;
                    justify-content: center;
                    align-self: center;
                    white-space: nowrap;
            }
        /* lift paste buttons slightly so they appear a bit higher than default */
        .action-button.paste { transform: translateY(-4px); }
        /* If paste button is textual (e.g., Livestream), make it slightly wider and vertically aligned */
        .action-button.paste.paste-text { width: auto; padding: 8px 10px; height: auto; transform: translateY(-4px); }
            .action-button.paste:hover { filter:brightness(0.98); }
                .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; }

/* Clipboard fallback modal */
.clipboard-fallback-overlay { position: fixed; inset:0; background: rgba(0,0,0,0.6); display:flex; align-items:center; justify-content:center; z-index:2000; }
.clipboard-fallback { background: var(--form-background); padding:18px; border-radius:10px; width:90%; max-width:420px; box-shadow:0 8px 30px rgba(0,0,0,0.3); }
.clipboard-fallback textarea { width:100%; min-height:100px; padding:8px; border-radius:6px; border:1px solid var(--border-color); }
.clipboard-fallback .actions { display:flex; gap:8px; justify-content:flex-end; margin-top:12px; }

/* NEW: pressed / tap effect for interactive controls */
button, .action-button, .login-button, input[type="button"], input[type="submit"], a.action-button {
    transition: transform 120ms cubic-bezier(.2,.9,.2,1), box-shadow 120ms, opacity 120ms;
    will-change: transform, opacity;
}

/* Generic modal */
.modal-overlay { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 2100; }
.modal-overlay.hidden { display: none; }
.modal-overlay:not(.hidden) { display: flex; }
.modal-overlay .modal-backdrop { position: absolute; inset:0; background: rgba(0,0,0,0.55); }
.modal-overlay .modal-content { position: relative; background: var(--bg-color); color: var(--text-color); padding: 18px; border-radius: 10px; max-width: 560px; width: 92%; box-shadow: 0 12px 30px rgba(0,0,0,0.28); border:1px solid var(--border-color); }
.modal-overlay .modal-content h3 { margin: 0 0 10px; }
.modal-overlay .modal-body { max-height: 60vh; overflow: auto; margin-bottom: 12px; }
.modal-overlay .modal-actions { display:flex; gap:8px; justify-content:flex-end; }

/* Visual state when activated via pointer/keyboard or when JS toggles .pressed */
button:active, .action-button:active, .login-button:active, input[type="button"]:active, input[type="submit"]:active, a.action-button:active,
button.pressed, .action-button.pressed, .login-button.pressed, input[type="button"].pressed, input[type="submit"].pressed, a.action-button.pressed {
    transform: translateY(1px) scale(0.985);
    box-shadow: 0 3px 8px rgba(0,0,0,0.06) inset;
    opacity: 0.98;
}

/* Animation for submission cards */
@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.submission-card {
  animation: cardFadeIn 300ms ease-out forwards;
}

#submissions-list-container.reloading .submission-card {
  opacity: 0;
  transition: opacity 150ms ease-in-out;
}

/* Keep the compact paste buttons visually consistent (they had an upward offset)
     when pressed we slightly reduce the lift and scale down */
.action-button.paste.pressed { transform: translateY(-2px) scale(0.96); }

  #mobile-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--form-background);
    padding: 10px 15px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    display: flex;
    gap: 10px;
    z-index: 1000;
  }
  #mobile-action-bar .action-button {
    width: 50%;
    margin: 0;
  }
  @media (min-width: 769px) {
    #mobile-action-bar {
      display: none;
    }
  }
  @media (max-width: 768px) {
    .submit-button {
      display: none; /* Hide original submit button on mobile */
    }
    body {
      padding-bottom: 80px; /* Add padding to prevent content from being hidden by the action bar */
    }
  }

.form-section {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background-color: var(--form-bg-color);
}

.form-section h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}
