/* ==========================================================================
   1. VARIABLES & BASE STYLES
   ========================================================================== */

/* 1.1 Non-Themed Root Variables */
:root {
  /* Variables that NEVER change between themes go here */
  --transition-speed: 0.3s;

  /* Accent colors can stay if they are consistent */
  --color-success: #4caf50;
  --color-warning: #ff9800;
  --color-info: #2196f3;
  --color-contact: #9c27b0;
  --accent-primary: #5271ff;
  --accent-primary-hover: #2e48c0;
}

/* 1.2 Dark Mode Theme (Default) */
[data-theme="dark"] {
  --bg-primary: #1c1c1c;
  --bg-secondary: #2a2a2a;
  --bg-tertiary: #222;
  --bg-gradient-start: #2a2a2a;
  --bg-gradient-end: #1a1a1a;
  --text-primary: #e0e0e0;
  --text-secondary: #ccc;
  --text-heading: #fff;
  --text-disabled: #555;
  --border-primary: #444;
  --border-secondary: #383838;
  --accent-primary-transparent: rgba(228, 77, 38, 0.3);
  --accent-border: rgba(228, 77, 38, 0.5);
  --accent-glow: rgba(228, 77, 38, 0.5);
  --shadow-color: rgba(0, 0, 0, 0.3);
  --shadow-strong-color: rgba(0, 0, 0, 0.4);
  --shadow-text-color: rgba(0, 0, 0, 0.7);
  --card-border-light-trans: rgba(255, 255, 255, 0.1);
  --card-bg-trans: rgba(42, 42, 42, 0.7);
  --spinner-base: rgba(228, 77, 38, 0.2);
  --spinner-top: var(--accent-primary);
  --card-sheen-gradient: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0)
  );
  --bg-overlay-dark: rgba(0, 0, 0, 0.8);
  --element-bg-hover: #3a3a3a;
  --color-success-bg: rgba(76, 175, 80, 0.15);
  --color-danger-bg: rgba(244, 67, 54, 0.15);
  --color-danger: #f44336;
  --color-open-source: #8b4513;
}

/* 1.3 Light Mode Theme */
[data-theme="light"] {
  --bg-primary: #f4f4f4;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e0e0e0;
  --bg-gradient-start: #ffffff;
  --bg-gradient-end: #f0f0f0;
  --text-primary: #333333;
  --text-secondary: #555555;
  --text-heading: #111111;
  --text-disabled: #aaaaaa;
  --border-primary: #cccccc;
  --border-secondary: #dddddd;
  --accent-primary-transparent: rgba(228, 77, 38, 0.15);
  --accent-border: rgba(228, 77, 38, 0.4);
  --accent-glow: rgba(228, 77, 38, 0.3);
  --shadow-color: rgba(0, 0, 0, 0.1);
  --shadow-strong-color: rgba(0, 0, 0, 0.15);
  --shadow-text-color: rgba(0, 0, 0, 0.2);
  --card-border-light-trans: rgba(0, 0, 0, 0.1);
  --card-bg-trans: rgba(255, 255, 255, 0.8);
  --spinner-base: rgba(228, 77, 38, 0.15);
  --spinner-top: var(
    --accent-primary
  ); /* Already defined in :root, but good to have here for consistency */
  --card-sheen-gradient: linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.03),
    rgba(0, 0, 0, 0)
  );
  --bg-overlay-dark: rgba(244, 244, 244, 0.85);
  --element-bg-hover: #e8e8e8;
  --color-success-bg: rgba(76, 175, 80, 0.1);
  --color-danger-bg: rgba(244, 67, 54, 0.1);
  --color-danger: #d32f2f;
  --color-open-source: #795548;
}

/* 1.2 Base Element Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color var(--transition-speed) ease,
    color var(--transition-speed) ease;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-speed) ease;
}
a:hover {
  color: var(--accent-primary-hover);
}

h1,
h2,
h3 {
  color: var(--text-heading);
  font-weight: 700;
  margin-bottom: 0.5em;
  font-weight: 700;
}

/* --- 3. LAYOUT & HEADER STYLES --- */

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem; /* Give some space on the sides */
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-primary);
  transition: border-color 0.3s ease;
}

.header-left .logo-link {
  display: flex;
  align-items: center;
  gap: 0.75rem; /* Space between icon and text */
  text-decoration: none;
}

.header-left .logo-link h1 {
  font-size: 1.5rem;
  margin-bottom: 0;
  color: var(--text-heading);
  transition: color 0.3s ease;
}

.header-left .logo-link:hover h1 {
  color: var(--accent-primary);
}
.header-left .logo-link .material-symbols-outlined {
  font-size: 2.5rem;
  color: var(--accent-primary);
  transition: color 0.3s ease;
}
.header-left .logo-link:hover .material-symbols-outlined {
  color: var(--accent-primary-hover);
}

.header-left .logo-link .material-symbols-outlined {
  font-size: 2rem;
  color: var(--accent-primary);
}

.logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  gap: 10px;
}

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

.app-name {
  margin: 0;
  font-size: 1.5rem;
  color: inherit;
}

/* Hide h1 on mobile devices */
@media (max-width: 768px) {
  .app-name {
    display: none;
  }
}

/* For smaller mobile devices */
@media (max-width: 480px) {
  .logo {
    height: 32px;
  }
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

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

.main-nav a {
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.5rem 0; /* Add padding for easier clicking */
  border-bottom: 2px solid transparent; /* For active state later */
}

.main-nav ul li.active a {
  color: var(
    --color-accent
  ); /* Change the text color to your theme's accent color */
  font-weight: 700; /* Make the font bold */
}

/* Optional: Add a subtle underline effect */
.main-nav ul li.active a::after {
  content: "";
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--accent-primary);
  margin-top: 2px;
}

.main-nav a:hover {
  color: var(--text-heading);
  text-decoration: none;
}

.separator {
  width: 1px;
  height: 24px;
  background-color: var(--border-primary);
  transition: background-color 0.3s ease;
}

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

.icon-button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Hide the mobile hamburger menu button on desktop by default */
.icon-button.mobile-menu-toggle {
  display: none;
}

.icon-button:hover {
  color: var(--text-heading);
  background-color: rgba(0, 0, 0, 0.05); /* A subtle hover effect */
  text-decoration: none;
}

/* Adjust hover effect for dark mode */
[data-theme="dark"] .icon-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.main-content {
  background-color: var(--bg-secondary);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-primary);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* --- 5. DASHBOARD-SPECIFIC STYLES --- */

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

.dashboard-header h2 {
  font-size: 2rem;
  font-weight: 800;
}

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

/* Stat Cards */
.stat-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.stat-card .material-symbols-outlined {
  font-size: 2rem;
  color: var(--accent-primary);
  padding: 0.75rem;
  border-radius: 50%;
  background-color: rgba(0, 123, 255, 0.1);
}

.stat-info .stat-number {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-heading);
}

.stat-info .stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Action Cards */
.action-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.action-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.action-card:hover {
  transform: translateY(-5px); /* Lift the card on hover */
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  text-decoration: none;
  color: var(--text-heading);
}

[data-theme="dark"] .action-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.action-card .material-symbols-outlined {
  font-size: 3rem;
  color: var(--accent-primary);
  margin-bottom: 1rem;
}

.action-card h3 {
  font-size: 1.25rem;
  color: var(--text-heading);
  margin-bottom: 0.5rem;
}

.action-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.action-card.action-card-highlight {
  /* Use the main background color as the base, which is a subtle grey/dark grey */
  background-color: var(--bg-primary);

  /* Use the main accent color for the border to make it pop */
  border: 1px solid var(--accent-primary);
}

/* Make the icon and title use the accent color as well */
.action-card.action-card-highlight .material-symbols-outlined,
.action-card.action-card-highlight h3 {
  color: var(--accent-primary);
}

/* Add a special hover effect for the highlight card */
.action-card.action-card-highlight:hover {
  /* Use a semi-transparent version of the accent color for the background */
  background-color: rgba(
    167,
    116,
    36,
    0.1
  ); /* This is a transparent version of your #a77424 accent */
  transform: translateY(-5px); /* Keep the lift effect */
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1); /* Keep the shadow effect */
}

[data-theme="dark"] .action-card.action-card-highlight:hover {
  background-color: rgba(
    167,
    116,
    36,
    0.15
  ); /* A slightly more opaque version for dark mode */
}

@media (max-width: 768px) {
  .stat-cards-container {
    /* Override the grid layout for mobile */
    display: flex; /* Use flexbox for a horizontal layout */
    overflow-x: auto; /* This is the key: enables horizontal scrolling */
    padding-bottom: 1rem; /* Add some padding for the scrollbar to sit in */

    /* Hide the scrollbar for a cleaner look (optional but recommended) */
    scrollbar-width: none; /* For Firefox */
    -ms-overflow-style: none; /* For Internet Explorer & Edge */
  }

  /* Webkit-specific rule to hide the scrollbar */
  .stat-cards-container::-webkit-scrollbar {
    display: none;
  }

  /* Ensure each card has a fixed minimum width on mobile */
  .stat-cards-container .stat-card {
    flex: 0 0 220px; /* Do not grow, do not shrink, base width of 220px */
  }
}

/* --- 6. FORM & UPLOAD PAGE STYLES --- */

.page-header {
  border-bottom: 1px solid var(--border-primary);
  margin-bottom: 2rem;
  padding-bottom: 1rem;
}

.page-header h1 {
  font-size: 1.8rem;
  font-weight: 800;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-top: 0.25rem;
}

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

.upload-form label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-heading);
}

.upload-form input[type="text"],
.upload-form textarea,
.upload-form select {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-family: "Inter", sans-serif;
  background-color: var(
    --color-background
  ); /* Use background color for subtle contrast */
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  color: var(--text-heading);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.upload-form input:focus,
.upload-form textarea:focus,
.upload-form select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15); /* A glow effect */
}

.upload-form textarea {
  resize: vertical; /* Allow users to resize vertically only */
}

.form-hint {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

/* Custom file input styling could be added later for a more futuristic look */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: "Inter", sans-serif;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--accent-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--accent-primary-hover);
  color: #ffffff;
  text-decoration: none;
}

/* --- 7. ALERT & MESSAGE STYLES --- */

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

.alert {
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 500;
}

.alert-success {
  background-color: #d1e7dd;
  color: #0f5132;
  border-color: #badbcc;
}

.alert-error {
  background-color: #f8d7da;
  color: #842029;
  border-color: #f5c2c7;
}

/* Dark mode alerts */
[data-theme="dark"] .alert-success {
  background-color: #0f5132;
  color: #d1e7dd;
  border-color: #198754;
}

[data-theme="dark"] .alert-error {
  background-color: #842029;
  color: #f8d7da;
  border-color: #dc3545;
}

/* --- 8. NOTES & DOCUMENTS PAGE STYLES --- */

.filter-bar {
  background-color: var(--bg-primary);
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 2rem;
  border: 1px solid var(--border-primary);
}

/* This targets the <a> tag with the .btn-clear-filters class */
.filter-bar .btn-clear-filters {
  /* --- Basic Button Shape & Alignment --- */
  display: inline-flex; /* Use flex to center content vertically and allow icons later */
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.2rem; /* Generous padding for a good click area */
  border-radius: 8px; /* Rounded corners to match your aesthetic */
  text-decoration: none; /* Remove the default link underline */
  font-weight: 500; /* A medium font weight */
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease-in-out; /* Smooth transition for hover effects */

  /* --- "Outline" Button Style --- */
  background-color: transparent; /* No background fill */
  border: 1px solid var(--border-primary); /* A simple border */
  color: var(
    --color-text-secondary
  ); /* Muted text color for a secondary action */
}

/* --- Hover & Focus State --- */
/* This provides visual feedback when the user interacts with the button */
.filter-bar .btn-clear-filters:hover,
.filter-bar .btn-clear-filters:focus {
  background-color: rgba(
    0,
    0,
    0,
    0.04
  ); /* Very subtle background color on hover */
  color: var(--text-heading); /* Make text slightly darker */
  border-color: #b0b0b0; /* Slightly darken the border */
  transform: translateY(-1px); /* Subtle lift effect */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); /* A faint shadow to lift it off the page */
}

/* --- Dark Mode Specific Hover State --- */
[data-theme="dark"] .filter-bar .btn-clear-filters:hover,
[data-theme="dark"] .filter-bar .btn-clear-filters:focus {
  background-color: rgba(
    255,
    255,
    255,
    0.08
  ); /* Use a light, transparent color for dark mode hover */
  color: #fff; /* Brighter text on hover */
  border-color: #777; /* A lighter border for dark mode */
}

/* Show the filter form on desktop */
.filter-form-container {
  display: block;
}

#mobile-filter-toggle {
  display: none;
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.filter-form input[type="text"],
.filter-form select {
  flex-grow: 1; /* Allow fields to grow and fill space */
  min-width: 150px;
  background-color: var(--bg-secondary); /* White/dark surface */
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  color: var(--text-heading);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-form .btn-primary {
  flex-grow: 0;
  align-items: center;
  justify-content: center;
}

/* Document Card Styling */
.document-list {
  display: grid;
  gap: 1.5rem;
}

/* This makes the card behave like a link */
.clickable {
  display: flex; /* or block, depending on your card's original display property */
  text-decoration: none;
  color: inherit; /* Inherits text color from parent, so it doesn't turn blue */
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

/* Adds a subtle lift effect on hover to show it's clickable */
.clickable:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

/* Prevent the expand button on mobile from triggering the card link */
.document-card-mobile .expand-toggle {
  position: relative;
  z-index: 2; /* Puts the button "on top" of the card link */
}

.document-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  gap: 1.5rem;
  transition: box-shadow 0.2s ease;
}

.document-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
[data-theme="dark"] .document-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  border-color: var(--accent-primary);
}

.document-card-mobile {
  display: none;
}

.doc-icon {
  flex-shrink: 0;
}
.doc-icon .material-symbols-outlined {
  font-size: 2rem;
  color: var(--accent-primary);
}

.doc-details {
  flex-grow: 1;
}

.doc-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.doc-description {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2; /* Limit to 2 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.doc-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.doc-meta .material-symbols-outlined {
  font-size: 1rem;
}

.doc-actions {
  flex-shrink: 0;
  text-align: right;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
}

.doc-actions .file-size {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.doc-actions .btn {
  padding: 0.6rem 1rem;
}
.doc-actions .btn .material-symbols-outlined {
  font-size: 1.2rem;
}

.doc-info-bar {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 1rem;
}

/* No Results Card */
.no-results-card {
  background-color: var(--bg-primary);
  border: 2px dashed var(--border-primary);
  border-radius: 12px;
  padding: 3rem;
  text-align: center;
  color: var(--text-secondary);
}
.no-results-card .material-symbols-outlined {
  font-size: 4rem;
  margin-bottom: 1rem;
}
.no-results-card h3 {
  color: var(--text-heading);
}

/* --- 9. PROFILE PAGE STYLES --- */

.my-uploads-section {
  margin-top: 3rem;
}

.my-uploads-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-primary);
  padding-bottom: 0.75rem;
}

/* Re-style document card actions for this page */
.my-uploads-section .doc-actions {
  flex-direction: row; /* Horizontal buttons */
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
}

/* New button styles for secondary/danger actions */
.btn-secondary {
  background-color: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-primary);
}
.btn-secondary:hover {
  background-color: var(--bg-primary);
  color: var(--text-heading);
  text-decoration: none;
  border-color: var(--text-secondary);
}

.btn-danger {
  background-color: transparent;
  color: #dc3545; /* A standard danger red */
  border: 1px solid #dc3545;
}
.btn-danger:hover {
  background-color: #dc3545;
  color: #ffffff;
  text-decoration: none;
}

/* --- 10. AUTHENTICATION PAGE STYLES --- */

.auth-page-body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: var(--bg-primary);
}

.auth-container {
  max-width: 450px;
  width: 100%;
  padding: 2rem;
}

.auth-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  margin-bottom: 2rem;
}
.auth-logo h1 {
  font-size: 1.8rem;
  color: var(--text-heading);
  margin: 0;
}
.auth-logo .material-symbols-outlined {
  font-size: 2.5rem;
  color: var(--accent-primary);
}

.auth-card {
  background-color: var(--bg-secondary);
  padding: 2rem 2.5rem;
  border-radius: 12px;
  border: 1px solid var(--border-primary);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .auth-card {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card input[type="text"] {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-family: "Inter", sans-serif;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  color: var(--text-heading);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.auth-card input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15); /* A glow effect */
}
.auth-card input::placeholder {
  color: var(--text-secondary);
}
.auth-card .form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.auth-card .form-group label {
  font-weight: 600;
  color: var(--text-heading);
}
.auth-card .form-group .form-hint {
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.auth-card .form-group .form-hint a {
  color: var(--accent-primary);
  text-decoration: none;
}
.auth-card .form-group .form-hint a:hover {
  color: var(--accent-primary-hover);
  text-decoration: underline;
}
.auth-card .form-group .form-hint a:focus {
  outline: none;
  color: var(--accent-primary-hover);
}
.auth-card .form-group .form-hint a:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}
.auth-card .form-group .form-hint a:focus:not(:focus-visible) {
  outline: none;
}
.auth-card .form-group .form-hint a:focus:not(:focus-visible) {
  outline: none;
}
.auth-card .form-group .form-hint a:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}
.auth-card .form-group .form-hint a:focus:not(:focus-visible) {
  outline: none;
}
.auth-card .form-group .form-hint a:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}
.auth-card .form-group .form-hint a:focus:not(:focus-visible) {
  outline: none;
}
.auth-card .form-group .form-hint a:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}
.auth-card .form-group .form-hint a:focus:not(:focus-visible) {
  outline: none;
}
.auth-card .form-group .form-hint a:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}
.auth-card .form-group .form-hint a:focus:not(:focus-visible) {
  outline: none;
}
.auth-card .form-group .form-hint a:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}
.auth-card .form-group .form-hint a:focus:not(:focus-visible) {
  outline: none;
}
.auth-card .form-group .form-hint a:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}
.auth-card .form-group .form-hint a:focus:not(:focus-visible) {
  outline: none;
}
.auth-card .form-group .form-hint a:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}
.auth-card .form-group .form-hint a:focus:not(:focus-visible) {
  outline: none;
}
.auth-card .form-group .form-hint a:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}
.auth-card .form-group .form-hint a:focus:not(:focus-visible) {
  outline: none;
}
.auth-card .form-group .form-hint a:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}
.auth-card .form-group .form-hint a:focus:not(:focus-visible) {
  outline: none;
}
.auth-card .form-group .form-hint a:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}
.auth-card .form-group .form-hint a:focus:not(:focus-visible) {
  outline: none;
}
.auth-card .form-group .form-hint a:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}
.auth-card .form-group .form-hint a:focus:not(:focus-visible) {
  outline: none;
}
.auth-card .form-group .form-hint a:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}
.auth-card .form-group .form-hint a:focus:not(:focus-visible) {
  outline: none;
}
.auth-card .form-group .form-hint a:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}
.auth-card .form-group .form-hint a:focus:not(:focus-visible) {
  outline: none;
}

.auth-card h2 {
  text-align: center;
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
}
.auth-card p {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.auth-form .btn {
  width: 100%;
  justify-content: center;
  padding-top: 1rem;
  padding-bottom: 1rem;
  font-size: 1.1rem;
}

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
}

/* --- PASSWORD RESET STYLES --- */

.email-simulation {
  margin-top: 1.5rem;
  padding: 1rem;
  background-color: var(--bg-primary);
  border-radius: 8px;
  border: 1px solid var(--border-primary);
}

.email-simulation h4 {
  margin-bottom: 0.5rem;
}

.email-simulation p {
  font-size: 0.9rem;
  text-align: left;
  margin-bottom: 1rem;
}

.reset-link-box {
  width: 100%;
  padding: 0.75rem;
  font-family: monospace;
  font-size: 0.9rem;
  background-color: var(--bg-secondary);
  color: var(--text-heading);
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  resize: none;
  word-break: break-all;
}

/* --- 4. FOOTER STYLES --- */

.app-footer {
  text-align: center;
  padding: 2rem 0;
  margin-top: 2rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/*
=====================================================================
  11. MOBILE RESPONSIVE STYLES (MEDIA QUERIES)
=====================================================================
*/

/* Apply these styles on screens 768px or smaller */
@media (max-width: 768px) {
  /* --- General Layout on Mobile --- */
  .app-container {
    padding: 0; /* Reduce side padding on smaller screens */
  }
  .main-content {
    padding: 1rem; /* Reduce padding inside main cards */
  }

  /* --- Mobile Header & Navigation --- */
  .icon-button.mobile-menu-toggle {
    display: flex; /* Show the hamburger button */
    order: 3; /* Move it to the end of the flex container */
  }

  .main-nav {
    display: none; /* Hide the desktop navigation by default */
    position: absolute;
    top: 80px; /* Position it below the header */
    left: 0;
    right: 0;
    width: 100%;
    background-color: var(--bg-secondary);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid var(--border-primary);
    z-index: 1000;
  }

  /* When the menu is active, show it */
  .main-nav.active {
    display: block;
  }

  .main-nav ul {
    flex-direction: column; /* Stack nav links vertically */
    padding: 1rem 0;
    width: 100%;
    gap: 0;
  }

  .main-nav li a {
    display: block;
    padding: 1rem 1.5rem; /* Make the whole area clickable */
    border-bottom: none;
  }

  .header-right .separator {
    display: none; /* Hide the separator line on mobile */
  }

  /* Hide the Desktop Card on Mobile */
  .notes-container .document-card {
    display: none;
  }

  /* --- Mobile Document List View --- */
  /* Show and Style the REVISED Mobile Card */
  .document-card-mobile {
    display: flex; /* Use flexbox for the main layout: icon on left, details on right */
    align-items: flex-start; /* Align icon and text to the top */
    gap: 1rem; /* Space between icon and details */
    padding: 1rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    text-decoration: none; /* Since the whole card is a link */
    color: inherit;
  }

  /* Style the large icon on the left */
  .document-card-mobile .doc-icon .material-symbols-outlined {
    font-size: 2.5rem; /* ~40px */
    color: var(--accent-primary); /* Use a theme color */
    margin-top: -2px; /* Small adjustment for better visual alignment */
  }

  /* This is the main container for all the text content */
  .document-card-mobile .doc-details {
    flex: 1; /* Allow this section to take up the remaining space */
    display: flex;
    flex-direction: column; /* Stack title, meta, and info vertically */
    gap: 0.75rem; /* Space between the text sections */
  }

  /* Style the document title */
  .document-card-mobile .doc-title {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
    color: var(--text-heading);
  }

  /* This styles BOTH the metadata and the info bar sections */
  .document-card-mobile .doc-meta,
  .document-card-mobile .doc-info-bar {
    display: flex;
    flex-wrap: wrap; /* Allows items to wrap onto a new line on very small screens */
    gap: 0.5rem 1rem; /* 0.5rem vertical gap, 1rem horizontal gap */
    font-size: 0.8rem;
    color: var(--text-secondary);
  }

  /* This styles each individual item (e.g., "Department", "File Size") */
  .document-card-mobile .doc-meta span,
  .document-card-mobile .doc-info-bar span {
    display: flex;
    align-items: center;
    gap: 0.3rem; /* Space between the small icon and its text */
  }

  /* Style the small icons within the metadata */
  .document-card-mobile .doc-meta .material-symbols-outlined,
  .document-card-mobile .doc-info-bar .material-symbols-outlined {
    font-size: 1rem; /* 16px */
  }

  /* Keep the download button as a small icon button */
  .doc-actions {
    flex-shrink: 0;
    display: flex; /* Make buttons align nicely */
    gap: 0.5rem;
  }
  .doc-actions .btn.btn-primary {
    background: none;
    padding: 0.5rem;
    border-radius: 50%;
    min-width: 0;
    color: var(--accent-primary);
  }
  .doc-actions .btn.btn-primary:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--accent-primary-hover);
  }
  [data-theme="dark"] .doc-actions .btn.btn-primary:hover {
    background-color: rgba(255, 255, 255, 0.1);
  }
  .doc-actions .btn .download-text {
    display: none;
  }

  /* Hide the main filter form by default on mobile */
  .filter-form-container {
    display: none;
  }

  /* When active, show it with a nice slide-down effect */
  .filter-form-container.active {
    display: block;
    margin-top: 1rem; /* Add some space between button and form */
    animation: slideDown 0.5s ease-out;
  }

  /* The button to show the filters */
  #mobile-filter-toggle {
    display: flex; /* This makes it visible on mobile */
    width: 100%;
    justify-content: center;
  }

  /* A simple animation for the slide down effect */
  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* --- Mobile Styles for Profile Page Document List --- */
  .profile-container .document-card {
    flex-direction: row; /* Arrange items in a row */
    flex-wrap: wrap; /* Allow content to wrap if needed */
    align-items: center;
    padding: 1rem;
  }

  .profile-container .doc-details {
    flex-grow: 1; /* Allow title to take up space */
  }

  .profile-container .doc-actions {
    flex-direction: row; /* Place edit/delete buttons side-by-side */
    gap: 0.75rem;
  }

  /* Hide the meta info by default on mobile to save space */
  .profile-container .doc-meta {
    display: none;
  }

  .input-with-button-container {
    display: flex;
    align-items: center;
    gap: 10px; /* Space between the dropdown and the button */
  }
  .input-with-button-container select {
    flex-grow: 1; /* Makes the select box take up available space */
  }
  .btn-add-new {
    padding: 5px 10px;
    border: 1px solid #ccc;
    background-color: #f0f0f0;
    cursor: pointer;
    white-space: nowrap; /* Prevents the text from wrapping */
    border-radius: 4px;
  }
  .btn-add-new:hover {
    background-color: #e0e0e0;
  }
  .add-new-container {
    display: flex; /* This will be toggled by JS, but we style it here */
    gap: 10px;
  }
  .add-new-container input[type="text"] {
    flex-grow: 1;
  }

  /* --- Filter Bar on Mobile --- */
  .filter-form {
    flex-direction: column; /* Stack filter inputs vertically */
    align-items: stretch; /* Make them all full width */
  }
}

/* ====================================================== */
/*  12. LOGIN PAGE STYLES                                 */
/* ====================================================== */

/* --- Main Container: Centers the card on the page --- */
.login-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 75vh; /* Ensures it's centered even on tall screens */
  padding: 2rem 1rem;
  width: 100%;
}

/* --- The Login Card itself --- */
.login-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 16px; /* Softer, more modern corners */
  padding: 2.5rem 3rem;
  max-width: 450px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.04);

  /* A subtle fade-in animation when the page loads */
  animation: fadeIn 0.6s ease-out;
}

/* --- Dark Mode Specifics for the Card --- */
[data-theme="dark"] .login-card {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
}

/* --- Logo at the top of the card --- */
.login-logo {
  width: 60px;
  height: 60px;
  margin: 0 auto 1.5rem auto; /* Center the logo and add space below */
}

/* --- Main "Welcome" Heading --- */
.login-card h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 0.75rem;
}

/* --- Descriptive Paragraph Text --- */
.login-card p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 2.5rem; /* Creates a clear separation before the button */
}

/* --- The Google Sign-in Button (The Star of the Show) --- */
.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600; /* Bolder text for the main action */
  border-radius: 8px;
  border: 1px solid var(--border-primary);
  background-color: var(--bg-secondary);
  color: var(--text-heading);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  gap: 12px; /* Space between the icon and the text */
}

.btn-google:hover {
  transform: translateY(-2px); /* Subtle lift effect */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  background-color: var(--color-surface-hover);
  border: 1px solid var(--color-border-hover);
}

[data-theme="dark"] .btn-google:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* The Google "G" logo inside the button */
.btn-google img {
  width: 20px;
  height: 20px;
}

/* --- Small footer note --- */
.login-footer-note {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2rem;
  margin-bottom: 0;
}

/* --- Keyframe animation for the fade-in effect --- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Mobile Responsiveness for the Login Page --- */
@media (max-width: 768px) {
  .login-card {
    padding: 2rem 1.5rem; /* Reduce padding on smaller screens */
  }

  .login-card h2 {
    font-size: 1.5rem;
  }
}

/* ====================================================== */
/*  13. CHAT PAGE SPECIFIC LAYOUT                         */
/*  These styles only apply when the body has the         */
/*  .body-no-scroll class, which is added on chat.php.    */
/* ====================================================== */

/* When on the chat page, disable the main page scroll */
body.body-no-scroll {
  overflow: hidden;
}

/* Make the app container fill the screen height */
body.body-no-scroll .app-container {
  height: calc(var(--vh, 1vh) * 100);
  display: flex;
  flex-direction: column;
}

/* Make the main content area take all available vertical space */
body.body-no-scroll .main-content {
  flex-grow: 1;
  display: flex; /* This is key for children to fill height */
  flex-direction: column;
  padding: 0; /* Remove padding to allow chat window to go edge-to-edge */
}

/* Target the direct child of main-content (our .chat-page-container) */
body.body-no-scroll .main-content > .chat-page-container {
  flex-grow: 1; /* Allow the chat page container to fill the main content area */
}

body.body-no-scroll .chat-fab {
  display: none;
}

/* --- Floating Action Button for Chat --- */
.chat-fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  background-color: var(--accent-primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  text-decoration: none;
  transition: all 0.2s ease-in-out;
  z-index: 1000;
}

.chat-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  color: white;
}

.chat-fab .material-symbols-outlined {
  font-size: 2rem;
}

/* ====================================================== */
/*  8.5. APP PROMO BANNER (NEW SECTION)                   */
/* ====================================================== */

.app-promo-banner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden; /* Important for the hide animation */
  transition: all 0.4s ease-in-out;
}

/* Styles for when the banner is hidden by JS */
.app-promo-banner.hidden {
  opacity: 0;
  height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-bottom: 0;
  border-width: 0;
}

.promo-icon .material-symbols-outlined {
  font-size: 3rem; /* 48px */
  color: var(--accent-primary);
}

.promo-text {
  flex-grow: 1; /* Takes up available space */
}

.promo-text h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1.2rem;
  color: var(--text-heading);
}

.promo-text p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.promo-cta img {
  height: 50px; /* Standard height for Play Store badges */
  width: auto;
  transition: transform 0.2s ease;
}
.promo-cta a:hover img {
  transform: scale(1.05); /* Subtle grow effect on hover */
}

.promo-close-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.promo-close-btn:hover {
  color: var(--text-heading);
  background-color: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .promo-close-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* --- App Promo Banner on Mobile --- */
.app-promo-banner {
  flex-direction: column; /* Stack items vertically */
  align-items: flex-start; /* Align to the left */
  text-align: left;
  gap: 1rem;
  padding: 1.5rem 1rem; /* Adjust padding for mobile */
}

.promo-icon {
  display: none; /* Hide the generic icon on mobile to save space */
}

.promo-cta {
  margin-top: 0.5rem;
}

.promo-close-btn {
  top: 0.75rem;
  right: 0.75rem;
}
