/* Main Styles for MP PWA */
:root {
  --primary-color: #1a4d3a;
  --secondary-color: #2d6a4f;
  --accent-color: #4a9d6a;
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.8);
  --text-muted: rgba(255, 255, 255, 0.6);
  --bg-dark: #0a1a12;
  --bg-glass: rgba(255, 255, 255, 0.1);
  --bg-glass-strong: rgba(255, 255, 255, 0.15);
  --border-glass: rgba(255, 255, 255, 0.2);
  --shadow-dark: rgba(0, 0, 0, 0.3);
  --shadow-light: rgba(255, 255, 255, 0.1);
  --danger-color: #e74c3c;
  --success-color: #27ae60;
}

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

html, body {
  height: 100%;
  width: 100%;
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-dark);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  padding: 0;
}

/* Prevent horizontal scrolling on all elements */
* {
  max-width: 100%;
}

img, video, iframe, embed, object {
  max-width: 100%;
  height: auto;
}

/* Ensure containers don't overflow */
.container, .app-container, .main-content, .view-content {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  position: relative;
  background: var(--bg-dark);
  pointer-events: auto !important;
  overflow: auto !important;
}

/* Login view background */
#login-view {
  background-image: url('/assets/homebackground.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

/* View-specific backgrounds */
.view-content {
  min-height: calc(100vh - 70px);
  padding: 20px 0;
  position: relative;
}

/* Background overlay for each view */
.view-content::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-color: var(--bg-dark);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* Show background for active view */
.view-content.active::before {
  opacity: 1;
}

.view-content[id="home-view"]::before {
  background-image: url('/assets/homebackground.png');
}

.view-content[id="todos-view"]::before {
  background-image: url('/assets/todobackground.png');
}

.view-content[id="callnotes-view"]::before {
  background-image: url('/assets/todobackground.png');
}

.view-content[id="articles-view"]::before {
  background-image: url('/assets/articlesbackground.png');
}

.view-content[id="profile-view"]::before {
  background-image: url('/assets/profilebackground.png');
}

.view-content[id="calendar-view"]::before,
.view-content[id="chat-view"]::before,
.view-content[id="ai-view"]::before,
.view-content[id="compensation-view"]::before,
.view-content[id="graphs-view"]::before,
.view-content[id="moves-view"]::before {
  background-image: url('/assets/homebackground.png');
}

/* Remove body background when in app view */
#app-view .view {
  background: transparent;
}

#app {
  min-height: 100vh;
  width: 100%;
  pointer-events: auto !important;
  position: relative;
  z-index: 1;
}

/* Loading Screen - Hidden by default */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-dark);
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  z-index: -1 !important;
  opacity: 0 !important;
}

.loading-screen.show {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  visibility: visible !important;
  pointer-events: auto !important;
  z-index: 9999 !important;
  opacity: 1 !important;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--bg-glass);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-screen p {
  margin-top: 20px;
  color: var(--text-secondary);
  font-size: 16px;
}

/* View Management */
.view {
  width: 100%;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.view.hidden {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Login View */
.login-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
  position: relative;
  z-index: 10;
  pointer-events: auto !important;
}

.login-container * {
  pointer-events: auto !important;
}

.login-form {
  pointer-events: auto !important;
}

.login-form input,
.login-form button {
  pointer-events: auto !important;
  cursor: pointer !important;
}

.login-left {
  flex: 2;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.login-right {
  flex: 1;
  background: transparent;
}

.login-content {
  width: 100%;
  max-width: 500px;
  padding: 40px;
}

.login-header {
  margin-bottom: 60px;
}

.login-logo {
  height: 40px;
  width: auto;
}

.login-title {
  font-size: 32px;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 40px;
  line-height: 1.2;
  font-family: serif;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  font-family: serif;
}

.form-group input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--text-primary);
  padding: 10px 0;
  font-size: 18px;
  color: var(--text-primary);
  font-family: serif;
  outline: none;
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.form-underline {
  height: 1px;
  background: var(--text-primary);
  width: 100%;
}

.mfa-container {
  margin-top: 20px;
  padding: 20px;
  background: var(--bg-glass);
  border-radius: 15px;
  border: 1px solid var(--border-glass);
}

.mfa-help {
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 5px;
}

.error-message {
  color: var(--danger-color);
  font-size: 14px;
  margin-top: 10px;
  padding: 10px;
  background: rgba(231, 76, 60, 0.1);
  border-radius: 8px;
}

.error-message.hidden {
  display: none;
}

.login-footer {
  margin-top: 60px;
}

.login-footer-logo {
  height: 30px;
  width: auto;
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
  background: var(--bg-dark);
  background-color: var(--bg-dark);
  position: relative;
  z-index: 0;
}

/* Navigation Bar - Top Horizontal */
.nav-sidebar {
  width: 100%;
  height: 70px;
  min-height: 70px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
  box-shadow: 0 4px 20px var(--shadow-dark), 0 -2px 3px var(--shadow-light);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
}

.nav-icons {
  display: flex;
  flex-direction: row;
  gap: 8px;
  width: 100%;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.nav-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px;
  min-width: 50px;
  height: 58px;
  transition: all 0.3s ease;
  position: relative;
  flex: 0 0 auto;
}

.nav-icon:hover {
  transform: translateY(-2px);
}

.nav-icon.active {
  background: var(--bg-glass-strong);
  border-radius: 8px;
}

.nav-icon-svg {
  width: 44px;
  height: 44px;
  color: var(--text-primary);
  background: var(--bg-glass);
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border-glass);
  box-shadow: 0 2px 4px var(--shadow-dark), 0 -1px 2px var(--shadow-light);
  flex-shrink: 0;
}

.nav-icon.active .nav-icon-svg {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 8px var(--shadow-dark), 0 2px 4px var(--shadow-light);
}

.nav-label {
  font-size: 8px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.1;
  font-family: serif;
  white-space: nowrap;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 70px 10px 0 10px;
  position: relative;
  overflow-y: auto;
  margin-top: 0;
}

.content-header {
  display: flex;
  justify-content: flex-end;
  padding: 20px 0 20px 0;
}

.header-logo {
  height: 24px;
  width: auto;
}

.content-footer {
  display: flex;
  justify-content: flex-end;
  padding: 20px 0 40px 0;
}

.footer-logo {
  height: 64px;
  width: auto;
  position: fixed;
  bottom: 20px;
  right: 30px;
  z-index: 999;
  pointer-events: none;
}

/* View Content */
.view-content {
  flex: 1;
  display: none;
  padding: 10px 0;
  width: 100%;
}

.view-content.active {
  display: block;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 30px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: serif;
  outline: none;
}

.btn-primary {
  background: #4a9d6a;
  color: #1a1a1a;
}

.btn-primary:hover {
  background: #5ab37a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 157, 106, 0.4);
}

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

.btn-secondary {
  background: rgba(255, 255, 255, 0.8);
  color: #1a1a1a;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.9);
}

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

.btn-danger:hover {
  background: #c0392b;
}

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

/* Glass Section */
.glass-section {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  border: 1px solid var(--border-glass);
  box-shadow: 0 8px 15px var(--shadow-dark), 0 -2px 2px var(--shadow-light);
  padding: 25px;
  margin-bottom: 25px;
}

.glass-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.glass-section-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
}

.glass-section-value {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
}

/* Empty State */
.empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: 16px;
  padding: 40px 20px;
}

.loading {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px 20px;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

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

.mt-20 {
  margin-top: 20px;
}

.mb-20 {
  margin-bottom: 20px;
}
