/* =========================
   CSS Custom Properties (Variables)
   ========================= */

:root {
  /* Colors */
  --primary-color: #667eea;
  --primary-hover: #5a6fd8;
  --secondary-color: #764ba2;
  --success-color: #4CAF50;
  --error-color: #ff4444;
  --warning-color: #ff9800;
  --info-color: #2196F3;
  
  /* Background Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #e9ecef;
  --bg-overlay: rgba(0, 0, 0, 0.5);
  
  /* Text Colors */
  --text-primary: #333333;
  --text-secondary: #666666;
  --text-muted: #999999;
  --text-light: #ffffff;
  
  /* Border Colors */
  --border-light: #e0e0e0;
  --border-medium: #cccccc;
  --border-dark: #999999;
  
  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-xxl: 48px;
  
  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 50%;
  
  /* Shadows */
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 8px 24px rgba(0, 0, 0, 0.2);
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
  
  /* Z-Index Scale */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-toast: 1080;
}

/* =========================
   Dashboard Styles
   ========================= */

/* =========================
   Reset & Base Styles
   ========================= */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 40px 20px;
    overflow-x: hidden;
}

/* =========================
   Layout Components
   ========================= */

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

.header {
    text-align: center;
    margin-bottom: 50px;
    color: white;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 140px;
    padding: 40px 80px 0 80px;
}

.header h1 {
    font-size: 2.5em;
    font-weight: 600;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.time {
    font-size: 1.1em;
    opacity: 0.9;
    font-weight: 400;
    margin-top: 10px;
    text-shadow: 0 1px 5px rgba(0,0,0,0.2);
}

/* Header Controls */
.header-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 5;
}

.settings-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px) rotate(90deg);
}

.settings-icon {
    font-size: 1.1em;
}

/* Settings Modal Styles */
.settings-content {
    padding: 20px 0;
}

.settings-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.settings-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.settings-section h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1.1em;
    font-weight: 600;
}

.setting-item {
    margin-bottom: 15px;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 1em;
    color: #555;
    transition: color 0.2s ease;
}

.setting-label:hover {
    color: #333;
}

.setting-checkbox {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    margin-right: 12px;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.setting-checkbox:checked + .checkmark {
    background: #667eea;
    border-color: #667eea;
}

.setting-checkbox:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.setting-text {
    font-weight: 500;
}

/* Edit Mode Styles */
.grid.edit-mode .app-icon-wrap {
    position: relative;
}

.edit-controls {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.grid.edit-mode .app-icon-wrap:hover .edit-controls {
    opacity: 1;
}

.edit-controls button {
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
}

.edit-controls button:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.edit-controls .edit-btn:hover {
    background: rgba(33, 150, 243, 0.9);
}

.edit-controls .delete-btn:hover {
    background: rgba(244, 67, 54, 0.9);
}

.edit-controls .hide-btn:hover {
    background: rgba(255, 152, 0, 0.9);
}

.edit-controls .outline-btn {
    background: transparent !important;
    border: 2px solid rgba(255, 255, 255, 0.8) !important;
    color: white !important;
}

.edit-controls .outline-btn:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(255, 255, 255, 1) !important;
    transform: scale(1.1);
}

/* Red X Delete Button */
.delete-btn-red {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4444;
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 30;
    opacity: 1;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    transition: all 0.2s ease;
}

.delete-btn-red:hover {
    background: #cc0000;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.4);
}

/* Outline Add Box */
.add-box {
    position: relative;
    /* Ensure it behaves exactly like other app-icon-wrap elements */
    display: block;
}

.add-box .app-icon {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 3px dashed rgba(255, 255, 255, 0.6) !important;
    color: white !important;
    transition: all 0.3s ease;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 20px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    /* Remove any width/height overrides that might affect grid */
}

.add-box .app-icon:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.8) !important;
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.add-box .app-icon .icon {
    font-size: 3em;
    margin-bottom: 12px;
}

.add-box .app-icon .app-name {
    font-size: 0.95em;
    font-weight: 500;
    word-wrap: break-word;
}

/* Done Button */
.done-edit-btn {
    display: block;
    margin: 30px auto;
    background: #4CAF50;
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 25px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    transition: all 0.3s ease;
    max-width: 200px;
}

.done-edit-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
}


.time-controls {
    display: flex;
    gap: 8px;
}




.restart-defaults-btn {
    background: rgba(255, 87, 87, 0.2);
    border-color: rgba(255, 87, 87, 0.3);
}

.restart-defaults-btn:hover {
    background: rgba(255, 87, 87, 0.3);
    border-color: rgba(255, 87, 87, 0.5);
    transform: translateY(-2px);
}

.toggle-quotes-btn {
    background: rgba(255, 165, 0, 0.2);
    border-color: rgba(255, 165, 0, 0.3);
}

.toggle-quotes-btn:hover {
    background: rgba(255, 165, 0, 0.3);
    border-color: rgba(255, 165, 0, 0.5);
    transform: translateY(-2px);
}

.add-issue-btn {
    background: rgba(255, 100, 100, 0.2);
    border-color: rgba(255, 100, 100, 0.3);
}

.add-issue-btn:hover {
    background: rgba(255, 100, 100, 0.3);
    border-color: rgba(255, 100, 100, 0.5);
    transform: translateY(-2px);
}

.suggest-feature-btn {
    background: rgba(100, 200, 100, 0.2);
    border-color: rgba(100, 200, 100, 0.3);
}

.suggest-feature-btn:hover {
    background: rgba(100, 200, 100, 0.3);
    border-color: rgba(100, 200, 100, 0.5);
    transform: translateY(-2px);
}


.toggle-24hr-btn,
.toggle-seconds-btn {
    flex: 1;
    min-width: 0;
    font-size: 0.85em;
    padding: 8px 12px;
}

.toggle-24hr-btn {
    background: rgba(100, 200, 255, 0.2);
    border-color: rgba(100, 200, 255, 0.3);
}

.toggle-24hr-btn:hover {
    background: rgba(100, 200, 255, 0.3);
    border-color: rgba(100, 200, 255, 0.5);
    transform: translateY(-2px);
}

.toggle-seconds-btn {
    background: rgba(150, 100, 255, 0.2);
    border-color: rgba(150, 100, 255, 0.3);
}

.toggle-seconds-btn:hover {
    background: rgba(150, 100, 255, 0.3);
    border-color: rgba(150, 100, 255, 0.5);
    transform: translateY(-2px);
}


/* =========================
   Search Components
   ========================= */

.search-bar {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 15px 20px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.search-bar input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 1.1em;
    background: transparent;
}

/* =========================
   App Grid & Icons
   ========================= */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.app-icon {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 150px;
    position: relative;
}

.app-icon:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 1);
}

.app-icon:active {
    transform: translateY(-2px) scale(1.02);
}

.icon {
    font-size: 3em;
    margin-bottom: 12px;
}

.app-name {
    font-size: 0.95em;
    font-weight: 500;
    word-wrap: break-word;
}

.icon img.app-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* =========================
   Add Button
   ========================= */

.add-box {
    /* Remove conflicting styles - let it behave like a regular app-icon-wrap */
}

/* =========================
   Delete Button
   ========================= */

.delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    font-size: 16px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 20;
    pointer-events: auto;
}

.app-icon:hover .delete-btn {
    display: flex;
}

.delete-btn:hover {
    background: #cc0000;
}


/* =========================
   Onboarding Modal
   ========================= */

.onboarding-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.onboarding-modal.show {
  display: flex;
}

.onboarding-content {
  background: white;
  border-radius: 24px;
  padding: 40px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.4s ease-out;
}

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

.onboarding-header {
  text-align: center;
  margin-bottom: 30px;
}

.onboarding-header h2 {
  font-size: 2.2em;
  margin-bottom: 10px;
  color: #333;
  font-weight: 700;
}

.onboarding-header p {
  color: #666;
  font-size: 1.1em;
  margin: 0;
}

.onboarding-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
  margin-bottom: 30px;
}

.onboarding-step {
  text-align: center;
  padding: 20px;
  border-radius: 16px;
  background: #f8f9fa;
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.onboarding-step:hover {
  border-color: #667eea;
  background: #f0f2ff;
  transform: translateY(-2px);
}

.step-icon {
  font-size: 2.5em;
  margin-bottom: 15px;
}

.onboarding-step h3 {
  font-size: 1.2em;
  margin-bottom: 10px;
  color: #333;
  font-weight: 600;
}

.onboarding-step p {
  color: #666;
  font-size: 0.95em;
  line-height: 1.5;
  margin: 0;
}

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

.onboarding-note {
  font-size: 0.9em;
  color: #666;
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #ff9800;
  font-style: italic;
}

.onboarding-footer .btn {
  padding: 15px 40px;
  font-size: 1.1em;
  font-weight: 600;
  border-radius: 12px;
}


/* =========================
   Quote Banner
   ========================= */

.fire-quotes-footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
    margin-top: 40px;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.1);
    border-top: 3px solid #4c63d2;
}

.quote-title {
    font-size: 1.5em;
    font-weight: 600;
    color: white;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.quote-text {
    font-size: 1.2em;
    color: white;
    font-style: italic;
    line-height: 1.6;
    opacity: 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    transition: opacity 1s ease-in-out;
    max-width: 900px;
    margin: 0 auto;
}

.quote-text.visible {
    opacity: 1;
}

/* =========================
   Modal Components
   ========================= */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}



.modal-content h2 {
    margin-bottom: 25px;
    color: #333;
}

/* Add App Modal Sections */
.add-section {
    margin-bottom: 30px;
}

.add-section h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.2em;
    font-weight: 600;
}

.section-divider {
    text-align: center;
    margin: 30px 0;
    position: relative;
}

.section-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #ddd;
}

.section-divider span {
    background: white;
    padding: 0 20px;
    color: #666;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

.quick-add-icons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 12px;
}

.quick-add-icon {
    cursor: pointer;
    text-align: center;
    padding: 10px 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.quick-add-icon:hover {
    background: #f0f2ff;
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.quick-add-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    margin-bottom: 4px;
}

.quick-add-icon .app-name {
    font-size: 0.7em;
    color: #333;
    font-weight: 500;
    line-height: 1.1;
}

/* Quick Add Search */
.quick-add-search {
    margin-bottom: 15px;
}

.quick-add-search .search-input {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9em;
    transition: all 0.3s ease;
    background: white;
}

.quick-add-search .search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Delete Confirmation Modal */
.delete-modal {
    text-align: center;
    max-width: 400px;
    padding: 40px 30px;
}

.delete-icon {
    font-size: 3em;
    margin-bottom: 20px;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.delete-modal h2 {
    color: #ff4444;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.delete-modal p {
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1em;
    line-height: 1.5;
}

/* Suggest Feature Modal */
.suggest-modal {
    text-align: center;
    max-width: 450px;
    padding: 40px 30px;
}

.suggest-icon {
    font-size: 3em;
    margin-bottom: 20px;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { filter: drop-shadow(0 0 5px rgba(255, 193, 7, 0.5)); }
    to { filter: drop-shadow(0 0 15px rgba(255, 193, 7, 0.8)); }
}

.suggest-modal h2 {
    color: #4CAF50;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.suggest-modal p {
    color: #666;
    margin-bottom: 25px;
    font-size: 1.1em;
    line-height: 1.5;
}

.email-instructions {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    border: 2px solid #e9ecef;
}

.email-instructions p {
    margin-bottom: 15px;
    color: #333;
    font-weight: 500;
}

.email-link {
    margin-bottom: 15px;
}

.email-btn {
    background: #4CAF50;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1em;
    display: inline-block;
    transition: all 0.3s ease;
    border: 2px solid #4CAF50;
}

.email-btn:hover {
    background: #45a049;
    border-color: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    text-decoration: none;
    color: white;
}

.email-note {
    font-size: 0.9em;
    color: #666;
    margin: 0;
    font-style: italic;
}

/* Reset to Defaults Modal */
.reset-modal {
    text-align: center;
    max-width: 450px;
    padding: 40px 30px;
}

.reset-icon {
    font-size: 3em;
    margin-bottom: 20px;
    animation: spin 2s linear infinite;
}

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

.reset-modal h2 {
    color: #ff4444;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.reset-modal p {
    color: #666;
    margin-bottom: 20px;
    font-size: 1.1em;
    line-height: 1.5;
}

.reset-list {
    text-align: left;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    border: 2px solid #e9ecef;
}

.reset-list li {
    color: #333;
    margin-bottom: 8px;
    font-weight: 500;
}

.reset-list li:last-child {
    margin-bottom: 0;
}

.reset-warning {
    color: #ff4444 !important;
    font-weight: 600 !important;
    font-size: 1em !important;
    margin-bottom: 30px !important;
}


/* =========================
   Form Components
   ========================= */

.form-help {
  font-size: 0.8em;
  color: var(--text-muted);
  margin-top: var(--spacing-xs);
  line-height: 1.3;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.section-select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.section-select:focus {
    outline: none;
    border-color: #667eea;
}

.section-select {
    cursor: pointer;
}

/* =========================
   Icon Picker
   ========================= */

.icon-picker {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-top: 10px;
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px solid #e9ecef;
}

.icon-option {
    cursor: pointer;
    text-align: center;
    padding: 10px 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    width: 100%;
    height: 60px;
}

.icon-option:hover {
    background: #f0f2ff;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.icon-option.selected {
    background: #667eea;
    border-color: #4c63d2;
    transform: scale(1.1);
}

/* =========================
   Emoji Picker (New UI)
   ========================= */

.emoji-picker-container {
    margin-top: 15px;
}

.emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px solid #e9ecef;
}

.emoji-category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px solid #e9ecef;
}

.emoji-category-tab {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.emoji-category-tab:hover {
    background: #f0f2ff;
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-1px);
}

.emoji-category-tab.active {
    background: #667eea;
    border-color: #4c63d2;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.emoji-option {
    cursor: pointer;
    text-align: center;
    padding: 12px 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    min-height: 70px;
}

.emoji-option:hover {
    background: #f0f2ff;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.emoji-option.selected {
    background: #667eea;
    border-color: #4c63d2;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.emoji-preview {
    font-size: 2.2em;
    line-height: 1;
    display: block;
}

.icon-option:hover::after {
    content: "Click to add";
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 10;
}

.icon-preview {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.emoji-preview {
    font-size: 1.5em;
    line-height: 1;
    display: block;
    margin-bottom: 4px;
}

/* =========================
   Button Components
   ========================= */

.button-group {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #ddd;
    color: #333;
}

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

.btn-danger {
    background: #ff4444;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-danger:hover {
    background: #cc0000;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.3);
}

/* =========================
   Section Management
   ========================= */

.sections-list {
    margin-top: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.section-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 8px;
}

.section-item h3 {
    margin: 0;
    color: #333;
    font-size: 1em;
}

.section-delete-btn {
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.8em;
}

.section-delete-btn:hover {
    background: #cc0000;
}


.add-box {
    display: flex;
}

/* =========================
   Edit Mode for Apps
   ========================= */

.edit-mode .app-icon-wrap {
    position: relative;
}

.edit-mode .delete-btn {
    display: flex !important;
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4444;
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 30;
    opacity: 1;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.edit-mode .delete-btn:hover {
    background: #cc0000;
    transform: scale(1.1);
}

.edit-mode .app-icon {
    pointer-events: auto;
}

.edit-mode .app-icon:hover {
    transform: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.done-edit-btn {
    background: rgba(40, 167, 69, 0.9);
    color: white;
    border: 2px solid #28a745;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
    margin-top: 20px;
    width: 100%;
}

.done-edit-btn:hover {
    background: rgba(40, 167, 69, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

/* =========================
   Delete Confirmation Modal
   ========================= */

.delete-icon {
    font-size: 3em;
    margin-bottom: 20px;
    animation: shake 0.5s ease-in-out;
}

.delete-modal h2 {
    color: #ff4444;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.delete-modal p {
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1em;
    line-height: 1.5;
}

.btn-danger {
    background: #ff4444;
    color: white;
    border: 2px solid #ff4444;
}

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

.btn-secondary {
    background: #6c757d;
    color: white;
    border: 2px solid #6c757d;
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.delete-btn {
    display: none !important;
}

/* =========================
   Drag and Drop Styles
   ========================= */

.drag-handle {
    cursor: grab;
    user-select: none;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.edit-mode .drag-handle {
    cursor: grab !important;
    pointer-events: auto !important;
    z-index: 1;
}

.drag-handle:active {
    cursor: grabbing;
}

.edit-mode .drag-handle {
    cursor: grab !important;
    pointer-events: auto !important;
}

.edit-mode .drag-handle:hover {
    pointer-events: auto !important;
}

.edit-mode .drag-handle:active {
    cursor: grabbing !important;
}

.normal-mode .drag-handle {
    cursor: pointer;
}

.app-icon-wrap.dragging {
    opacity: 0.6;
    transform: rotate(5deg);
}

.app-icon-wrap.drag-over {
    outline: 3px dashed #667eea;
    transform: translateY(-2px) scale(1.02);
}

.app-icon.drag-over {
    outline: 3px dashed #667eea;
    transform: translateY(-2px) scale(1.02);
}

.app-icon.dragging {
    opacity: 0.6;
}

/* Visual indicator for draggable items */
.app-icon-wrap:not(.add-box):hover .drag-handle {
    position: relative;
}

.app-icon-wrap:not(.add-box):hover .drag-handle::after {
    content: "⋮⋮";
    position: absolute;
    top: -5px;
    right: -5px;
    background: rgba(0,0,0,0.1);
    border-radius: 3px;
    font-size: 12px;
    color: #666;
    padding: 2px 4px;
    line-height: 1;
}

/* =========================
   Responsive Design
   ========================= */

/* Half-screen desktop (1200px - 1600px) */
@media (max-width: 1600px) and (min-width: 1200px) {
    .container {
        max-width: 1000px;
    }
    
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 20px;
    }
    
    .app-icon {
        min-height: 140px;
        padding: 20px;
    }
    
    .icon {
        font-size: 2.8em;
    }
    
    .app-name {
        font-size: 0.9em;
    }
}

/* Tablet and smaller desktop (768px - 1199px) */
@media (max-width: 1199px) and (min-width: 768px) {
    .container {
        max-width: 900px;
    }
    
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 18px;
    }
    
    .app-icon {
        min-height: 130px;
        padding: 18px;
    }
    
    .icon {
        font-size: 2.6em;
    }
    
    .app-name {
        font-size: 0.85em;
    }
    
    .header h1 {
        font-size: 2.2em;
    }
    
    .header {
        padding: 30px 60px 0 60px;
        min-height: 120px;
    }
    
    .header-controls {
        top: 10px;
        right: 10px;
    }
    
    .time {
        font-size: 1em;
        margin-top: 8px;
    }
    
    .edit-controls {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        bottom: 15px;
        right: 15px;
        max-width: 250px;
        justify-content: flex-end;
    }
    
    
    .toggle-24hr-btn,
    .toggle-seconds-btn {
        font-size: 0.75em;
        padding: 6px 8px;
    }
}

/* Mobile landscape and small desktop (480px - 767px) */
@media (max-width: 767px) and (min-width: 480px) {
    body {
        padding: 20px 15px;
    }
    
    .container {
        max-width: 100%;
    }
    
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 15px;
    }

    .app-icon {
        min-height: 120px;
        padding: 15px;
    }

    .icon {
        font-size: 2.4em;
    }
    
    .app-name {
        font-size: 0.8em;
    }

    .quote-banner {
        padding: 20px 25px;
        min-height: 100px;
    }

    .quote-text {
        font-size: 1em;
    }

    .icon-picker {
        grid-template-columns: repeat(5, 1fr);
        gap: 8px;
    }
    
    .header h1 {
        font-size: 1.6em;
    }
    
    .time {
        font-size: 1em;
    }
    
    .edit-controls {
        flex-direction: column;
        gap: 6px;
        bottom: 10px;
        right: 10px;
    }
    
    
    .toggle-24hr-btn,
    .toggle-seconds-btn {
        font-size: 0.7em;
        padding: 5px 6px;
    }
}

/* Mobile portrait (up to 479px) */
@media (max-width: 479px) {
    body {
        padding: 15px 10px;
        font-size: 14px;
    }
    
    
    .container {
        max-width: 100%;
        padding: 0 5px;
    }
    
    .header {
        margin-bottom: 25px;
        text-align: center;
        padding: 20px 30px 0 30px;
        min-height: 100px;
    }
    
    .header h1 {
        font-size: 1.6em;
        margin-bottom: 8px;
        line-height: 1.2;
    }
    
    .header-controls {
        top: 8px;
        right: 8px;
    }
    
    .settings-btn {
        width: 35px;
        height: 35px;
        font-size: 1em;
    }
    
    .time {
        font-size: 0.9em;
        margin-top: 6px;
    }
    
    .welcome-message {
        font-size: 0.9em;
        margin-bottom: 20px;
        padding: 10px;
        line-height: 1.4;
    }
    
    .search-bar {
        width: 100%;
        margin-bottom: 15px;
        padding: 8px 12px;
    }
    
    .search-bar input {
        font-size: 14px; /* Prevents zoom on iOS */
        padding: 8px 12px;
    }
    
    
    
    
    
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(var(--dynamic-min-size, 70px), 1fr));
        gap: var(--dynamic-gap, 8px);
        margin-bottom: 80px; /* Extra space for Fire Quotes footer */
        padding-bottom: 20px; /* Additional padding for add button */
    }
    
    .app-icon {
        min-height: var(--dynamic-min-size, 70px);
        padding: var(--dynamic-padding, 8px);
        border-radius: 8px;
    }
    
    .app-icon .icon {
        font-size: var(--dynamic-icon-size, 1.4em);
        margin-bottom: 4px;
    }
    
    .app-icon .name {
        font-size: var(--dynamic-text-size, 0.65em);
        line-height: 1.1;
        word-break: break-word;
    }
    
    .delete-btn {
        width: 14px;
        height: 14px;
        font-size: 9px;
        top: 2px;
        right: 2px;
    }
    
    
    .toggle-24hr-btn,
    .toggle-seconds-btn {
        font-size: 0.65em;
        padding: 4px 6px;
        flex: 1;
        min-width: 0;
    }
    
    .edit-mode .delete-btn {
        width: 28px;
        height: 28px;
        font-size: 16px;
        top: -10px;
        right: -10px;
        min-width: 28px;
        min-height: 28px;
    }
    
    .onboarding-body {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    
    .onboarding-content {
        padding: 30px 20px;
        margin: 10px;
    }
    
    .onboarding-header h2 {
        font-size: 1.8em;
    }
    
    .onboarding-step {
        padding: 15px;
    }
    
    .step-icon {
        font-size: 2em;
    }

    .search-bar {
        padding: 6px 8px;
        margin-bottom: 12px;
    }
    
    .search-bar input {
        font-size: 0.9em;
        padding: 6px 8px;
    }

    .grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 12px;
        margin-bottom: 20px;
    }

    .app-icon {
        min-height: 100px;
        padding: 12px;
        border-radius: 15px;
    }
    
    .icon {
        font-size: 2em;
        margin-bottom: 8px;
    }
    
    .app-name {
        font-size: 0.75em;
        line-height: 1.2;
    }
    
    .add-box {
        /* Remove conflicting mobile styles - let it behave like a regular app-icon-wrap */
    }
    
    .edit-mode .delete-btn {
        width: 32px;
        height: 32px;
        font-size: 18px;
        top: -12px;
        right: -12px;
        min-width: 32px;
        min-height: 32px;
    }

    .fire-quotes-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 8px 12px;
        min-height: 50px;
        margin-top: 0;
        z-index: 100;
    }

    .quote-title {
        font-size: 1.2em;
        margin-bottom: 8px;
    }

    .quote-text {
        font-size: 1em;
        line-height: 1.4;
    }
    

    .modal-content {
        padding: 20px;
        margin: 10px;
        max-width: calc(100% - 20px);
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-content h2 {
        font-size: 1.2em;
        margin-bottom: 15px;
        text-align: center;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group label {
        font-size: 0.9em;
        margin-bottom: 6px;
        display: block;
    }
    
    .form-group input,
    .section-select {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
        width: 100%;
        box-sizing: border-box;
    }
    
    .icon-picker {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        padding: 10px;
        max-height: 200px;
    }
    
    .icon-option {
        padding: 8px;
        min-height: 50px;
    }
    
    .icon-preview {
        width: 24px;
        height: 24px;
    }
    
    .btn {
        font-size: 0.9em;
        padding: 12px 20px;
        width: 100%;
        margin-bottom: 8px;
    }
    
    .button-group {
        gap: 10px;
        margin-top: 20px;
        flex-direction: column;
    }
    
    .button-group .btn {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .quick-add-container {
        max-height: 60vh;
        overflow-y: auto;
    }
    
    .quick-add-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .quick-add-item {
        padding: 12px;
        min-height: 80px;
    }
    
    .quick-add-item .icon {
        font-size: 1.8em;
        margin-bottom: 6px;
    }
    
    .quick-add-item .name {
        font-size: 0.8em;
        line-height: 1.2;
    }
    
    .emoji-picker-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        max-height: 200px;
    }
    
    .emoji-option {
        min-height: 50px;
        padding: 8px;
    }
    
    .emoji-preview {
        font-size: 1.8em;
    }
    
    .delete-btn {
        width: 20px;
        height: 20px;
        font-size: 14px;
        top: 6px;
        right: 6px;
    }
    
    /* Touch-friendly improvements */
    .app-icon:active {
        transform: scale(0.95);
    }
    
    .btn:active {
        transform: scale(0.98);
    }
    
    /* Prevent horizontal scroll */
    body {
        overflow-x: hidden;
    }
    
    .container {
        overflow-x: hidden;
    }
    
    /* Mobile-specific improvements */
    .fire-quotes-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 6px 8px;
        margin: 0;
        border-radius: 0;
        z-index: 100;
    }
    
    .quote-title {
        font-size: 1.1em;
        margin-bottom: 6px;
    }
    
    .quote-text {
        font-size: 0.9em;
        line-height: 1.4;
    }
    
    /* Better touch targets */
    .app-icon {
        min-height: 100px;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Top right edit button - mobile */
    .edit-apps-btn-top {
        top: 15px;
        right: 15px;
        padding: 10px 16px;
        font-size: 0.9em;
        border-radius: 10px;
    }
    
    .btn {
        min-height: 36px; /* Smaller for mobile efficiency */
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Compact edit controls for developers */
    .edit-controls {
        z-index: 1000;
        transition: all 0.3s ease;
    }
    
    .edit-controls:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
    }
    
    /* Developer-friendly button styling */
    .edit-controls .btn {
        border: 1px solid rgba(102, 126, 234, 0.2);
        transition: all 0.2s ease;
    }
    
    .edit-controls .btn:hover {
        background: rgba(102, 126, 234, 0.1);
        transform: scale(1.02);
    }
    
    .edit-controls .btn:active {
        transform: scale(0.98);
    }
    
    /* Improved modal positioning */
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        border-radius: 16px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    }
    
    /* Better form inputs */
    input[type="text"], 
    input[type="url"], 
    select {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        border-radius: 8px;
    }
    
    /* Improved search bar */
    .search-bar {
        padding: 4px 6px;
        margin-bottom: 8px;
    }
    
    .search-bar input {
        border-radius: 20px;
        padding: 6px 12px;
        font-size: 0.85em;
    }
    
    /* Better button spacing */
    .edit-controls {
        z-index: 1000;
    }
    
    /* Prevent text selection on buttons */
    .btn, .app-icon, .delete-btn {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
}

/* Extra small mobile devices (up to 360px) */
@media (max-width: 360px) {
    body {
        padding: 10px 5px;
        font-size: 13px;
    }
    
    .header {
        padding: 15px 20px 0 20px;
        min-height: 80px;
    }
    
    .header h1 {
        font-size: 1.2em;
        margin-bottom: 6px;
    }
    
    .header-controls {
        top: 5px;
        right: 5px;
    }
    
    .settings-btn {
        width: 30px;
        height: 30px;
        font-size: 0.9em;
    }
    
    .time {
        font-size: 0.8em;
        margin-top: 4px;
    }
    
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(var(--dynamic-min-size, 60px), 1fr));
        gap: var(--dynamic-gap, 6px);
    }
    
    .app-icon {
        min-height: var(--dynamic-min-size, 60px);
        padding: var(--dynamic-padding, 6px);
    }
    
    .app-icon .icon {
        font-size: var(--dynamic-icon-size, 1.2em);
    }
    
    .app-icon .name {
        font-size: var(--dynamic-text-size, 0.6em);
    }
    
    
    .modal-content {
        padding: 15px;
        margin: 5px;
    }
    
    .quick-add-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .emoji-picker-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
}