/* OneDrive Clone Stylesheet
   Design Language: Microsoft Fluent UI
   Author: Antigravity Code Assistant
*/

:root {
  --primary-color: #0078d4;
  --primary-hover: #106ebe;
  --primary-bg-light: #eff6fc;
  --header-bg: #005a9e;
  --body-bg: #ffffff;
  --sidebar-bg: #f3f2f1;
  --sidebar-hover-bg: #edebe9;
  --sidebar-active-bg: #e1dfdd;
  --text-primary: #323130;
  --text-secondary: #605e5c;
  --text-white: #ffffff;
  --border-color: #edebe9;
  --border-dark: #a19f9d;
  --modal-overlay: rgba(0, 0, 0, 0.4);
  --shadow-fluent: 0 4px 16px rgba(0, 0, 0, 0.15);
  --shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.12);
  --font-stack: "Segoe UI", -apple-system, BlinkMacSystemFont, "Segoe WP", Tahoma, Geneva, Verdana, sans-serif;
}

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

body {
  font-family: var(--font-stack);
  color: var(--text-primary);
  background-color: var(--body-bg);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ==========================================================================
   Header Section (Top Navigation Bar)
   ========================================================================== */
.header-bar {
  height: 48px;
  background-color: var(--header-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  color: var(--text-white);
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-btn {
  background: none;
  border: none;
  color: var(--text-white);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
}

.menu-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.onedrive-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.header-center {
  flex: 1;
  max-width: 500px;
  margin: 0 20px;
  position: relative;
}

.search-container {
  display: flex;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 0 8px;
  height: 32px;
  transition: background-color 0.15s ease;
}

.search-container:hover {
  background-color: rgba(255, 255, 255, 0.25);
}

.search-container:focus-within {
  background-color: var(--body-bg);
  box-shadow: var(--shadow-fluent);
}

.search-container:focus-within svg {
  fill: var(--text-primary);
}

.search-container:focus-within input {
  color: var(--text-primary);
}

.search-icon {
  width: 16px;
  height: 16px;
  fill: var(--text-white);
  margin-right: 8px;
}

.search-input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-white);
  font-family: inherit;
  font-size: 14px;
  width: 100%;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.search-container:focus-within .search-input::placeholder {
  color: var(--text-secondary);
}

.search-dropdown-btn {
  background: none;
  border: none;
  color: inherit;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 2px;
}

.search-dropdown-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.search-container:focus-within .search-dropdown-btn {
  color: var(--text-secondary);
}

.search-container:focus-within .search-dropdown-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-icon-btn {
  background: none;
  border: none;
  color: var(--text-white);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
}

.header-icon-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.header-icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: 8px;
}

.profile-avatar svg {
  width: 18px;
  height: 18px;
  fill: var(--text-white);
}

/* ==========================================================================
   Main Workspace Layout (Sidebar + Content Panel)
   ========================================================================== */
.main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar Navigation */
.sidebar {
  width: 230px;
  background-color: var(--sidebar-bg);
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: 8px 16px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  padding: 8px 16px 8px 20px;
  height: 36px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  gap: 12px;
  position: relative;
  transition: background-color 0.1s ease;
}

.sidebar-nav-item:hover {
  background-color: var(--sidebar-hover-bg);
}

.sidebar-nav-item.active {
  background-color: var(--sidebar-active-bg);
  font-weight: 600;
}

.sidebar-nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background-color: var(--primary-color);
}

.sidebar-nav-item svg {
  width: 16px;
  height: 16px;
  fill: var(--text-secondary);
}

.sidebar-nav-item.active svg {
  fill: var(--primary-color);
}

.sidebar-footer {
  padding: 16px;
  font-size: 12px;
  color: var(--primary-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--border-color);
}

.sidebar-footer-link {
  cursor: pointer;
}

.sidebar-footer-link:hover {
  text-decoration: underline;
}

/* Content Area */
.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background-color: var(--body-bg);
}

/* Action Toolbar */
.action-toolbar {
  height: 44px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.action-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  padding: 6px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 2px;
  color: var(--text-primary);
  height: 32px;
}

.action-btn:hover {
  background-color: var(--sidebar-hover-bg);
}

.action-btn svg {
  width: 14px;
  height: 14px;
  fill: var(--primary-color);
}

.action-btn.btn-primary {
  background-color: var(--primary-color);
  color: var(--text-white);
  font-weight: 600;
}

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

.action-btn.btn-primary svg {
  fill: var(--text-white);
}

.action-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  color: var(--text-secondary);
}

.action-icon-btn:hover {
  background-color: var(--sidebar-hover-bg);
  color: var(--text-primary);
}

.action-icon-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* Page Contents Container */
.page-contents {
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.page-title {
  font-size: 20px;
  font-weight: 300;
  color: var(--text-primary);
}

/* ==========================================================================
   Modern Grid View Styles (Image 1 Dashboard)
   ========================================================================== */
.files-grid-modern {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

.file-card-modern {
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: var(--body-bg);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  aspect-ratio: 180/200;
}

.file-card-modern:hover {
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

.preview-container {
  flex: 1;
  background-color: #faf9f8;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.preview-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-details-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 60%, rgba(0,0,0,0) 100%);
  padding: 20px 12px 10px 12px;
  color: var(--text-white);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-details-overlay .file-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-details-overlay .file-meta {
  font-size: 10px;
  opacity: 0.8;
}

/* ==========================================================================
   Classic Alternative View Styles (Image 3 Shared Page)
   ========================================================================== */
.classic-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.classic-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 20px 0;
  border-bottom: 1px solid var(--border-color);
}

.classic-logo-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.classic-logo {
  height: 28px;
}

.classic-title-shared {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 16px;
}

.download-all-btn {
  color: var(--primary-color);
  font-weight: 600;
  font-size: 13px;
  background: none;
  border: none;
  cursor: pointer;
}

.download-all-btn:hover {
  text-decoration: underline;
  color: var(--primary-hover);
}

.classic-subtitle-files {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 20px 0 10px 0;
}

.files-grid-classic {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.file-card-classic {
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background-color: var(--body-bg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
}

.file-card-classic:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-hover);
}

.preview-container-classic {
  height: 180px;
  background-color: #faf9f8;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border-color);
}

.preview-container-classic img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card-details-classic {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--body-bg);
}

.file-icon-classic {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
}

.file-icon-classic svg {
  width: 20px;
  height: 20px;
}

.file-icon-classic.video { background-color: #fde7e9; color: #a80000; }
.file-icon-classic.image { background-color: #fde7e9; color: #d83b01; }
.file-icon-classic.pdf { background-color: #fde7e9; color: #d83b01; }
.file-icon-classic.excel { background-color: #dff6dd; color: #107c41; }

.file-info-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.file-info-text .file-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.classic-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding: 24px 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ==========================================================================
   Fluent Modal Overlay Dialog (Security Login)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--modal-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background-color: var(--body-bg);
  border-radius: 2px;
  width: 440px;
  max-width: 90%;
  box-shadow: var(--shadow-fluent);
  padding: 36px 44px;
  transform: scale(0.9);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.modal-overlay.active .modal-container {
  transform: scale(1);
}

.modal-logo-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.modal-logo {
  height: 28px;
}

.modal-logo-text {
  font-size: 20px;
  font-weight: 300;
  color: #0078d4;
  letter-spacing: 0.5px;
}

.modal-description {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-primary);
  margin-bottom: 24px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  position: relative;
  display: flex;
  flex-direction: column;
}

.fluent-input {
  font-family: inherit;
  font-size: 15px;
  border: none;
  border-bottom: 1px solid var(--border-dark);
  padding: 8px 0;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  transition: border-bottom-color 0.15s ease;
  width: 100%;
}

.fluent-input:focus {
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 7px; /* preserve overall height layout */
}

.fluent-input[readonly] {
  color: var(--text-secondary);
  border-bottom-color: var(--border-color);
  cursor: default;
}

.btn-container {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.fluent-btn-submit {
  background-color: var(--primary-color);
  color: var(--text-white);
  border: none;
  font-family: inherit;
  font-size: 15px;
  padding: 8px 32px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  min-width: 90px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.fluent-btn-submit:focus {
  outline: 2px solid #000000;
  outline-offset: 1px;
}

/* Loading/Success spinner within modal submit */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--text-white);
  animation: spin 0.8s linear infinite;
  display: none;
}

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

/* ==========================================================================
   Responsive Design Breakpoints
   ========================================================================== */
@media (max-width: 768px) {
  .sidebar {
    display: none; /* Hide sidebar on tablet/mobile like true responsive OneDrive drawer */
  }
  
  .header-center {
    max-width: none;
    margin: 0 10px;
  }
  
  .action-toolbar {
    padding: 0 16px;
  }
  
  .page-contents {
    padding: 16px 20px;
  }
  
  .files-grid-modern {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }
  
  .modal-container {
    padding: 24px 30px;
  }
}
