/* CSS Variables for Theme Support */
:root[data-theme="light"] {
  --primary-color: #06b6d4;
  --primary-hover: #0891b2;
  --secondary-color: #64748b;
  --background-color: linear-gradient(135deg, #e9ecef 0%, #dee2e6 50%, #ced4da 100%);
  --surface-color: linear-gradient(135deg, #ffffff 0%, #f3f4f6 50%, #e9ecef 100%);
  --surface-color-solid: #ffffff;
  --border-color: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --success-color: #059669;
  --warning-color: #d97706;
  --error-color: #dc2626;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

:root[data-theme="Solarized Dark"] {
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --secondary-color: #94a3b8;
  --background-color: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
  --surface-color: linear-gradient(135deg, #1e293b 0%, #334665 50%, #49638f 100%);
  --surface-color-solid: #1e293b;
  --border-color: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.3), 0 8px 10px -6px rgb(0 0 0 / 0.3);
}

:root[data-theme="dark"] {
  --primary-color: #8d6c1f;
  --primary-hover: #7e5c25;
  --secondary-color: #8b949e;
  --background-color: linear-gradient(135deg, #0d1117 0%, #161b22 50%, #21262d 100%);
  --surface-color: linear-gradient(135deg, #161b22 0%, #252d39 50%, #343f50 100%);
  --surface-color-solid: #161b22;
  --border-color: #30363d;
  --text-primary: #f0f6fc;
  --text-secondary: #c9d1d9;
  --text-muted: #8b949e;
  --success-color: #3fb950;
  --warning-color: #d29922;
  --error-color: #f85149;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.4), 0 8px 10px -6px rgb(0 0 0 / 0.4);
}

:root[data-theme="Aubergine"] {
  --primary-color: #178F65;
  --primary-hover: #127A56;
  --secondary-color: #83388A;

  --background-color: linear-gradient(135deg, #611F69 0%, #83388A 60%, #DF9FF4 100%);
  --surface-color: linear-gradient(135deg, #611F69 0%, #83388A 100%);
  --surface-color-solid: #611F69;
  --border-color: #83388A;

  --text-primary: #F4F0F5;
  --text-secondary: #CFA7E6;
  --text-muted: rgba(207, 167, 230, 0.75);

  --success-color: #178F65;
  --warning-color: #d29922;
  --error-color: #f85149;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.4), 0 8px 10px -6px rgb(0 0 0 / 0.4);
}

:root[data-theme="Mocha"] {
  --primary-color: #c18c5d;
  --primary-hover: #a8764d;
  --secondary-color: #d6c7bd;

  --background-color: linear-gradient(135deg, #1e130c 0%, #352016 45%, #9a8478 100%);
  --surface-color: linear-gradient(135deg, #2c1a12 0%, #3c281d 50%, #5a4135 100%);
  --surface-color-solid: #2c1a12;
  --border-color: #5c483d;

  --text-primary: #f6ede7;
  --text-secondary: #d8c8bc;
  --text-muted: #b6a499;

  --success-color: #8abf88;
  --warning-color: #d7a14d;
  --error-color: #d36b6b;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.4), 0 8px 10px -6px rgb(0 0 0 / 0.4);
}

:root[data-theme="Steel"] {
  --primary-color: #6cb0d6;
  --primary-hover: #4f96c0;
  --secondary-color: #b7c1cb;

  --background-color: linear-gradient(135deg, #5f7388 0%, #7f8d99 45%, #2c3e50 100%);
  --surface-color: linear-gradient(135deg, #3b4c5e 0%, #4d6074 50%, #5f7388 100%);
  --surface-color-solid: #3b4c5e;
  --border-color: #556677;

  --text-primary: #f2f5f8;
  --text-secondary: #cfd7df;
  --text-muted: #a9b4bf;

  --success-color: #7ac29f;
  --warning-color: #d8a45a;
  --error-color: #e07272;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.45);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.45), 0 2px 4px -2px rgb(0 0 0 / 0.45);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.45), 0 4px 6px -4px rgb(0 0 0 / 0.45);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.45), 0 8px 10px -6px rgb(0 0 0 / 0.45);
}

:root[data-theme="Slate"] {
  --primary-color: #6ac7c7;
  --primary-hover: #4ea7a9;
  --secondary-color: #9ba7b3;

  --background-color: linear-gradient(135deg, #485563 0%, #36414c 45%, #29323c 100%);
  --surface-color: linear-gradient(135deg, #2f3943 0%, #3a4550 50%, #45515d 100%);
  --surface-color-solid: #2f3943;
  --border-color: #485460;

  --text-primary: #ecf2f4;
  --text-secondary: #c6d1d6;
  --text-muted: #9aa6ad;

  --success-color: #7bc2a1;
  --warning-color: #d3a85a;
  --error-color: #de7b7b;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.45);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.45), 0 2px 4px -2px rgb(0 0 0 / 0.45);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.45), 0 4px 6px -4px rgb(0 0 0 / 0.45);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.45), 0 8px 10px -6px rgb(0 0 0 / 0.45);
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  background: var(--background-color);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.login-active > *:not(#loginContainer):not(style):not(script) {
  display: none;
}

body.auth-checking > *:not(style):not(script),
html.auth-checking body > *:not(style):not(script) {
  visibility: hidden;
  pointer-events: none;
}

body.login-active #loginContainer {
  display: flex;
}

body:not(.login-active) #loginContainer {
  display: none;
}

/* Header Styles */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  height: 60px;
  gap: 0.5rem;
  min-width: 0;
}

.header-left, .header-center, .header-right {
  display: flex;
  align-items: center;
  min-width: 0;
}


.header-left {
  flex: 0 1 auto;
}

.header-center {
  flex: 1 1 auto;
  justify-content: center;
  overflow: hidden;
}

.header-right {
  flex: 0 1 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex-shrink: 0;
}

.logo img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
}

.logo-text {
  font-weight: bold;
  font-size: clamp(1rem, 2vw, 1.5rem);
  font-family: 'Lora', Georgia, serif;
  background: linear-gradient(to right, #6c757d, #868e96, #adb5bd);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.logo-text:hover {
    background: linear-gradient(to right, #adb5bd, #868e96, #6c757d);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.main-nav {
  display: flex;
  gap: 0.25rem;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: clamp(0.7rem, 1.5vw, 0.875rem);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 40px;
  text-align: center;
}

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

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

.theme-toggle {
  padding: 0.5rem;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-right: 0.5rem;
}

.theme-toggle:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

/* Mobile menu - hidden by default, only shown on iPhone 11 portrait */
.mobile-menu,
.mobile-menu-btn {
  display: none;
}

.mobile-menu {
  position: absolute;
  top: 60px;
  right: 0.5rem;
  left: auto;
  width: min(280px, 85vw);
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  padding: 1rem;
  z-index: 99;
  border-radius: 12px;
}

.mobile-menu-user {
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.mobile-menu-user:empty {
  display: none;
}

.mobile-menu-user .user-info {
  width: 100%;
  justify-content: space-between;
  margin-left: 0;
  padding: 0.5rem 0.75rem;
}

.mobile-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mobile-nav .nav-btn {
  width: 100%;
  justify-content: flex-start;
  padding: 0.75rem 1rem;
  gap: 0.75rem;
  font-size: 0.95rem;
  border-radius: 8px;
  background: var(--surface-color-solid);
  border: 1px solid var(--border-color);
}

.mobile-nav .nav-btn span {
  display: inline !important;
}

.mobile-nav .nav-btn i {
  width: 20px;
  text-align: center;
}

.mobile-nav .nav-btn:hover {
  background: var(--border-color);
}

.mobile-nav .nav-btn.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.mobile-menu-actions {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.mobile-menu-actions .theme-toggle {
  padding: 0.5rem 1rem;
  width: 100%;
  justify-content: center;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface-color-solid);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.mobile-menu-actions .theme-toggle .theme-name {
  font-size: 0.9rem;
}

.mobile-menu-btn {
  width: 36px;
  height: 36px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: none;
  color: var(--text-primary);
  cursor: pointer;
}


/* Main Content */
.main-content {
  height: calc(100vh - 60px);
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

.view {
  display: none;
  padding: 2rem;
  min-height: 100%;
}

.view.active {
  display: block;
}

/* Home View Styles */
.home-logo {
  position: relative;
  margin: 0 auto 1.2rem auto;
  height: 80px;
  width: 280px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.home-logo img {
  position: absolute;
  top: 0;
  left: 0;
  max-width: 280px;
  height: auto;
}

.hero-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2.5rem;
  min-height: 60vh;
  margin-bottom: 1rem;
}

.hero-content h1 {
  font-size: 3rem;
  font-weight: bold;
  font-family: 'Lora', Georgia, serif;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
  text-align: center;
}

.hero-content p {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  line-height: 1.6;
  text-align: center;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.cta-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-size: 1rem;
}

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

.cta-button.primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.cta-button.secondary {
  background: transparent;
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.cta-button.secondary:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.floating-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

.card-preview {
  position: static;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  animation: float 6s ease-in-out infinite;
}

.card-preview:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary-color);
}

.card-preview:hover i {
  transform: scale(1.1);
  color: var(--primary-hover);
}

.card-preview:nth-child(1) {
  transform: translateX(-50%);
  animation-delay: 0s;
}

.card-preview:nth-child(2) {
  transform: translateX(-50%);
  animation-delay: -2s;
}

.card-preview:nth-child(3) {
  transform: translateX(-50%);
  animation-delay: -3s;
}

.card-preview:nth-child(4) {
  transform: translateX(-50%);
  animation-delay: -4s;
}

.card-preview:nth-child(5) {
  transform: translateX(-50%);
  animation-delay: -5s;
}

.card-preview:nth-child(6) {
  transform: translateX(-50%);
  animation-delay: -6s;
}

.card-preview:nth-child(7) {
  transform: translateX(-50%);
  animation-delay: -7s;
}

.card-preview:nth-child(8) {
  transform: translateX(-50%);
  animation-delay: -8s;
}

.card-preview:nth-child(9) {
  transform: translateX(-50%);
  animation-delay: -9s;
}

.card-preview:nth-child(10) {
  transform: translateX(-50%);
  animation-delay: -10s;
}

.card-preview:nth-child(11) {
  transform: translateX(-50%);
  animation-delay: -11s;
}

.card-preview:nth-child(12) {
  transform: translateX(-50%);
  animation-delay: -12s;
}

.card-preview i {
  font-size: 2rem;
  color: var(--primary-color);
}

.card-preview span {
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  color: var(--text-secondary);
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

.features-section h2 {
  font-size: 2.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 3rem;
  color: var(--text-primary);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.feature-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  transition: all 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary-color);
}

.feature-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}

.feature-icon i {
  font-size: 1.5rem;
  color: white;
}

.feature-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.feature-card p {
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Apps View Styles */
.apps-header {
  text-align: center;
  margin-bottom: 3rem;
}

.apps-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.apps-header p {
  font-size: 1.25rem;
  color: var(--text-secondary);
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
}

.app-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s ease;
  cursor: pointer;
}

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

.app-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.app-icon i {
  font-size: 1.25rem;
  color: white;
}

.app-info {
  flex: 1;
}

.app-info h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.app-info p {
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.app-tags {
  display: flex;
  gap: 0.5rem;
}

.tag {
  background: var(--border-color);
  color: var(--text-secondary);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
}

.app-launch-btn {
  width: 40px;
  height: 40px;
  background: var(--primary-color);
  border: none;
  border-radius: 10px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.app-launch-btn:hover {
  background: var(--primary-hover);
  transform: scale(1.05);
}

/* Settings View Styles */
.settings-header {
  margin-bottom: 2rem;
}

.settings-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.settings-header p {
  color: var(--text-secondary);
}

.settings-content {
  max-width: 600px;
}

.settings-section {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.settings-section h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

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

.setting-item label {
  color: var(--text-primary);
  font-weight: 500;
}

.setting-item option {
  background: var(--surface-color-solid);
  color: var(--text-primary);
}

.setting-item select,
.setting-item input[type="checkbox"] {
  background: var(--background-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.5rem;
  color: var(--text-primary);
}

.about-info {
  line-height: 1.8;
}

.about-info p {
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.about-info p:first-child {
  color: var(--text-primary);
  font-weight: 600;
}

/* App Container */
.app-container {
  position: fixed;
  top: 60px;
  left: 0;
  width: 100vw;
  height: calc(100vh - 60px);
  background: var(--background-color);
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow: hidden;
}

.app-container.active {
  transform: translateX(0);
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

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

.loading-spinner {
  background: var(--surface-color);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow-xl);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1100;
}

.toast {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.5rem;
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  max-width: 300px;
}

.toast.show {
  transform: translateX(0);
}

.toast.success {
  border-left: 4px solid var(--success-color);
}

.toast.error {
  border-left: 4px solid var(--error-color);
}

.toast.warning {
  border-left: 4px solid var(--warning-color);
}

/* Form Styles */
.form-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
}

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

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

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--background-color);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.2s ease;
}

.form-select option {
  background: var(--surface-color-solid);
  color: var(--text-primary);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
}

.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-size: 1rem;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: 500;
}

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

.btn-secondary {
  background: linear-gradient(135deg, #7f1d1d 0%, #b91c1c 50%, #ef4444 100%);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: linear-gradient(135deg, #991b1b 0%, #dc2626 50%, #f87171 100%);
}

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

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

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--surface-color);
}

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

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.minimized-taskbar {
  margin-bottom: 2rem;
  padding: 1rem;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.minimized-taskbar h3 {
  margin-bottom: 1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.minimized-apps-list {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.minimized-app-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--background-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.minimized-app-item:hover {
  border-color: var(--primary-color);
}

.minimized-app-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.minimized-app-actions {
  display: flex;
  gap: 0.25rem;
}

.restore-btn,
.close-minimized-btn {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.75rem;
}

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

.close-minimized-btn {
  background: var(--error-color);
  color: white;
}

.about-logo {
  position: relative;
  margin-bottom: 1.5rem;
  height: 80px;
  width: 280px;
}

.about-logo img {
  position: absolute;
  top: 0;
  left: 0;
  max-width: 280px;
  height: auto;
}

.logo-light {
  display: block;
}

.logo-dark {
  display: none;
}

:root[data-theme="dark"] .logo-light,
:root[data-theme="Solarized Dark"] .logo-light,
:root[data-theme="Aubergine"] .logo-light,
:root[data-theme="Mocha"] .logo-light,
:root[data-theme="Steel"] .logo-light,
:root[data-theme="Slate"] .logo-light {
  display: none;
}

:root[data-theme="dark"] .logo-dark,
:root[data-theme="Solarized Dark"] .logo-dark,
:root[data-theme="Aubergine"] .logo-dark,
:root[data-theme="Mocha"] .logo-dark,
:root[data-theme="Steel"] .logo-dark,
:root[data-theme="Slate"] .logo-dark {
  display: block;
}

#zoomIndicator {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: bold;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s, transform 0.3s;
  z-index: 9999;
}

#zoomIndicator.active {
  opacity: 1;
  transform: translateY(0);
}

.keyboard-shortcuts {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.keyboard-shortcuts h4 {
  margin-bottom: 1rem;
}

.shortcut-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.shortcut-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.shortcut-key {
  background: var(--background-color);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: monospace;
  border: 1px solid var(--border-color);
}

.mt-4 {
  margin-top: 1rem;
}

#clearCacheBtn {
  background: linear-gradient(135deg, #7f1d1d 0%, #b91c1c 50%, #ef4444 100%);
  color: white;
  border: none;
  margin-bottom: 0.75rem;
  margin-right: 1rem;
}

#clearCacheBtn:hover {
  background: linear-gradient(135deg, #991b1b 0%, #dc2626 50%, #f87171 100%);
}

/* Responsive Design */
@media (min-width: 1024px) {
  .floating-cards {
    max-width: 720px;
    gap: 1.2rem;
  }

  .card-preview {
    width: 140px;
    height: 140px;
  }

  .card-preview i {
    font-size: 2.5rem;
  }

  .card-preview span {
    font-size: 0.875rem;
  }

  .app-layout {
    grid-template-columns: 350px 1fr;
  }

  .results-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  #columnManagerDialog .modal-footer {
    position: sticky;
    bottom: 0;
    background: var(--surface-color-solid);
    padding: 0.75rem 1rem;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  #columnManagerDialog .modal-body {
    padding-bottom: 4.5rem;
  }
}

@media (max-width: 1200px) {
  .nav-btn span {
    display: none;
  }

  #columnManagerDialog .modal-footer .btn {
    width: 100%;
  }
}

/* iPad Pro 11" Portrait */
@media screen and (min-width: 810px) and (max-width: 900px) and (orientation: portrait),
       screen and (min-device-width: 834px) and (max-device-width: 834px) and (orientation: portrait) {
  .main-content,
  .app-container {
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
  }

  .view {
    padding: 1.5rem;
  }

  .main-nav {
    gap: 0.35rem;
  }

  .nav-btn {
    padding: 0.6rem;
    gap: 0;
    width: 44px;
    height: 44px;
    justify-content: center;
  }

  .nav-btn span {
    display: none;
  }

  .hero-section {
    gap: 2rem;
  }

  .floating-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 560px;
    gap: 0.75rem;
  }

  .floating-cards .card-preview {
    max-width: 140px;
    margin: 0 auto;
  }

  .apps-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
  }
}

/* iPad Pro 11" Landscape */
@media screen and (min-width: 1080px) and (max-width: 1200px) and (orientation: landscape),
       screen and (min-device-width: 1194px) and (max-device-width: 1194px) and (orientation: landscape) {
  .main-content,
  .app-container {
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
  }

  .view {
    padding: 1.75rem;
  }

  .nav-btn {
    padding: 0.6rem;
    gap: 0;
    width: 44px;
    height: 44px;
    justify-content: center;
  }

  .nav-btn span {
    display: none;
  }

  .apps-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  #columnManagerDialog .modal-footer .btn {
    width: 100%;
  }
}

@media (max-width: 910px) {
  .username {
    display: block;
  }

  .logo-text {
    display: block;
  }

  .user-role {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
  }

  .app-header {
    padding: 0.5rem;
  }

  .header-center {
    display: flex;
  }

  .hero-section {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }
  
  .hero-content h1 {
    font-size: 2rem;
  }
  
  .apps-grid {
    grid-template-columns: 1fr;
  }
  
  .view {
    padding: 1rem;
  }

  .app-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  
  .app-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    max-height: 40vh;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .results-stats {
    grid-template-columns: 1fr;
  }
  
  .preview-controls {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .modal-dialog {
    margin: 1rem;
    max-width: none;
  }

  .preview-cards {
    grid-template-columns: 1fr;
  }

  .csv-header {
    flex-direction: row;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
  }  

  .csv-stats {
    flex: 1;
    justify-content: flex-end;
    font-size: clamp(0.7rem, 0.65vw + 0.33rem, 0.92rem);
  }

  .csv-header .btn {
  flex-shrink: 0;
  width: auto;
  min-width: fit-content;
  }

  .csv-header h3 .filename {
    font-size: clamp(0.7rem, 0.65vw + 0.33rem, 0.92rem);
    max-width: calc(100vw - 100px);
  }

  .csv-stats span,
  .csv-stats span.text {
    display: inline;
  }

  .csv-stats button {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
  }

  #columnManagerDialog .modal-footer .btn {
    width: 100%;
  }
}

/* iPhone 11 Portrait - Only view where mobile menu is shown */
@media screen and (max-width: 430px) and (orientation: portrait) {
  .main-content,
  .app-container {
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
  }

  .app-header {
    padding: 0.35rem 0.6rem;
    gap: 0.35rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  /* Header left stays on left */
  .header-left {
    flex: 0 0 auto;
  }

  /* Hide header center (main nav) */
  .header-center {
    display: none;
  }

  /* Header right with mobile menu button on right */
  .header-right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  /* Hide theme toggle and user-info in header (they're in mobile menu) */
  .header-right .theme-toggle,
  .header-right .user-info {
    display: none !important;
  }

  /* Show mobile menu button */
  .mobile-menu-btn {
    display: inline-flex !important;
  }

  /* Mobile menu hidden by default, shown when open */
  .mobile-menu {
    display: none;
  }

  body.mobile-menu-open .mobile-menu {
    display: block;
  }

  /* Fix app-header to handle long titles */
  .app-header {
    min-height: auto;
    padding: 0.5rem 0.75rem;
    flex-wrap: nowrap;
  }

  .app-header-left {
    flex: 1;
    min-width: 0;
    gap: 0.5rem;
  }

  .app-title {
    min-width: 0;
    flex: 1;
  }

  .app-title h1 {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .back-btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    flex-shrink: 0;
  }

  .back-btn span {
    display: none;
  }

  .view {
    padding: 1rem;
  }

  .hero-section {
    gap: 1.5rem;
  }

  .floating-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    max-width: 100%;
  }

  .card-preview {
    max-width: 140px;
    margin: 0 auto;
  }

  .apps-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .settings-content {
    max-width: 100%;
  }

  .app-container {
    top: 60px;
  }
}

/* iPhone 11 Landscape */
@media screen and (max-width: 900px) and (orientation: landscape) {
  .main-content,
  .app-container {
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
  }

  .view {
    padding: 1rem 1.25rem;
  }

  .main-nav {
    gap: 0.25rem;
  }

  .nav-btn {
    padding: 0.45rem;
    gap: 0;
    width: 42px;
    height: 42px;
    justify-content: center;
  }

  .nav-btn span {
    display: none;
  }

  .floating-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
    max-width: 520px;
  }

  .apps-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }
}
