@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --bg-main: #F1F5F9;
  --card-bg: #FFFFFF;
  --sidebar-bg: #0F172A;
  --sidebar-text: #94A3B8;
  --sidebar-hover: #1E293B;
  --sidebar-active: #38BDF8;
  
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --primary-light: #EEF2FF;
  --primary-gradient: linear-gradient(135deg, #6366F1 0%, #3B82F6 100%);
  --accent-gradient: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
  
  --text-main: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  
  --border-color: #E2E8F0;
  --success: #10B981;
  --success-light: #D1FAE5;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px -8px rgba(15, 23, 42, 0.12);
  --shadow-primary: 0 10px 25px -5px rgba(79, 70, 229, 0.4);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Base Elements */
a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

h1, h2, h3, h4, h5 {
  color: var(--text-main);
  font-weight: 700;
  letter-spacing: -0.025em;
}

/* Luxury Auth / Login Layout */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 10% 20%, #1E1B4B 0%, #0F172A 90%);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.auth-wrapper::before {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
  top: -100px;
  right: -100px;
  border-radius: 50%;
  pointer-events: none;
}

.auth-card {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  width: 100%;
  max-width: 440px;
  padding: 48px 40px;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.3);
  position: relative;
  z-index: 10;
  animation: fadeIn 0.5s ease-out;
}

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

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(79, 70, 229, 0.08);
  border: 1px solid rgba(79, 70, 229, 0.15);
  color: var(--primary);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-header h1 {
  font-size: 26px;
  color: var(--text-main);
  margin-bottom: 8px;
}

.auth-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Forms */
.form-group {
  margin-bottom: 22px;
}

.form-group label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-main);
  letter-spacing: 0.01em;
  text-align: left;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: #FFFFFF;
  color: var(--text-main);
  transition: var(--transition);
  font-family: inherit;
  text-align: left;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

.form-control::placeholder {
  color: #A0AEC0;
}

/* Premium Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  padding: 12px 24px;
  font-size: 14px;
  border-radius: var(--radius-md);
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
  gap: 10px;
  letter-spacing: -0.01em;
}

.btn-primary {
  color: #FFFFFF;
  background: var(--primary-gradient);
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px -6px rgba(79, 70, 229, 0.5);
}

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

.btn-secondary {
  background: #F1F5F9;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

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

.btn-danger {
  background: #EF4444;
  color: #FFFFFF;
}

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

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-block {
  display: flex;
  width: 100%;
}

/* Dashboard App Layout */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
  background-color: var(--bg-main);
}

/* Sidebar */
.sidebar {
  width: 280px;
  background-color: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: var(--transition);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #FFFFFF;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.brand-text h2 {
  font-size: 15px;
  color: #FFFFFF;
  font-weight: 800;
  line-height: 1.2;
}

.brand-text span {
  font-size: 10px;
  color: var(--sidebar-text);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-menu {
  padding: 10px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 10px 4px 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  color: var(--sidebar-text);
  font-weight: 600;
  font-size: 13.5px;
  border-radius: 8px;
  transition: var(--transition);
  gap: 12px;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  transition: var(--transition);
}

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

.nav-item.active {
  background: var(--primary-gradient);
  color: #FFFFFF;
  box-shadow: 0 6px 16px -4px rgba(99, 102, 241, 0.4);
}

.sidebar-footer {
  padding: 12px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  z-index: 10;
}

.sidebar-footer a {
  cursor: pointer;
  position: relative;
  z-index: 11;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  margin-left: 280px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: var(--transition);
}

/* Header / Topbar */
.topbar {
  height: 76px;
  background-color: #FFFFFF;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

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

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
}

.page-title h3 {
  font-size: 20px;
  font-weight: 700;
}

.user-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 14px 6px 6px;
  background: #F8FAFC;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
}

.avatar-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-info .name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.user-info .role-tag {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Content Area */
.content-body {
  padding: 36px;
  flex: 1;
}

/* Dashboard Cards & Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.stat-card {
  background: #FFFFFF;
  border-radius: var(--radius-md);
  padding: 24px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 20px;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: #CBD5E1;
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.stat-icon.indigo { background: #EEF2FF; color: #4F46E5; }
.stat-icon.emerald { background: #ECFDF5; color: #10B981; }
.stat-icon.amber { background: #FEF3C7; color: #F59E0B; }

.stat-data .value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.stat-data .label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-top: 4px;
}

/* Content Cards */
.panel-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 28px;
  margin-bottom: 32px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 16px;
}

.panel-header h2 {
  font-size: 18px;
  font-weight: 700;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
}

.custom-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.custom-table th {
  background: #F8FAFC;
  padding: 14px 18px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

.custom-table td {
  padding: 16px 18px;
  font-size: 14px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.custom-table tr:last-child td {
  border-bottom: none;
}

.custom-table tbody tr {
  transition: var(--transition);
}

.custom-table tbody tr:hover {
  background-color: #F8FAFC;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
}

.badge-primary { background: #EEF2FF; color: var(--primary); }
.badge-success { background: #ECFDF5; color: var(--success); }
.badge-warning { background: #FEF3C7; color: #D97706; }

/* Teedy Style Visual Document Cards & Thumbnails */
.doc-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

.doc-card-teedy {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.doc-card-teedy:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: #CBD5E1;
}

.doc-thumb-box {
  height: 130px !important;
  max-height: 130px !important;
  background: #F8FAFC;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.doc-thumb-box img {
  width: 100% !important;
  height: 130px !important;
  max-height: 130px !important;
  object-fit: cover !important;
  object-position: top center;
  transition: transform 0.3s ease;
}

.doc-card-teedy:hover .doc-thumb-box img {
  transform: scale(1.05);
}

.doc-thumb-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  gap: 6px;
  width: 100%;
  height: 100%;
  padding: 12px;
}

.doc-thumb-placeholder svg {
  width: 42px;
  height: 42px;
}

.doc-thumb-placeholder span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 4px;
}

.doc-card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.doc-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Modal Lightbox Component */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.modal-card {
  background: #FFFFFF;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlide 0.3s ease-out;
}

@keyframes modalSlide {
  from { transform: translateY(20px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #F8FAFC;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.modal-close-btn:hover {
  background: #E2E8F0;
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  text-align: left;
  background: #F1F5F9;
  min-height: auto;
}

.modal-body.preview-body {
  align-items: center;
  justify-content: center;
}

.modal-body img {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.modal-body iframe {
  width: 100%;
  height: 60vh;
  border: none;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FFFFFF;
}

/* Teedy Style Tag Tree (Left Filter Panel) */
.teedy-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
  align-items: start;
}

.tag-tree-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.tag-tree-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tag-tree-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tag-tree-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.tag-tree-item:hover {
  background: #F8FAFC;
  color: var(--primary);
}

.tag-tree-item.active {
  background: #EEF2FF;
  color: var(--primary);
  border-color: #C7D2FE;
}

.tag-tree-item .count {
  font-size: 11px;
  background: #E2E8F0;
  color: var(--text-main);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.tag-tree-item.active .count {
  background: var(--primary);
  color: #FFFFFF;
}

/* NOTE Box */
.note-box {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  color: #92400E;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.note-box strong {
  color: #78350F;
}

/* View Switcher Controls */
.filter-toolbar {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.view-switcher {
  display: inline-flex;
  background: #F1F5F9;
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 4px;
}

.view-btn {
  border: none;
  background: transparent;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.view-btn.active {
  background: #FFFFFF;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Folder View Component */
.folder-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.folder-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.folder-header {
  background: #F8FAFC;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  user-select: none;
}

.folder-header:hover {
  background: #F1F5F9;
}

.folder-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
}

.folder-body {
  padding: 24px;
}

/* Alert Boxes */
.alert {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.alert-danger {
  background-color: var(--danger-light);
  color: #991B1B;
  border: 1px solid #FCA5A5;
}

.alert-success {
  background-color: var(--success-light);
  color: #065F46;
  border: 1px solid #6EE7B7;
}

/* Mobile Sidebar Backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 95;
}

/* Search Input Component */
.search-box {
  position: relative;
  width: 100%;
  max-width: 320px;
}

.search-box input {
  padding-left: 40px;
}

.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .teedy-layout {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.show {
    transform: translateX(0);
  }
  
  .sidebar-backdrop.show {
    display: block;
  }
  
  .main-wrapper {
    margin-left: 0;
  }
  
  .mobile-toggle {
    display: flex;
  }
  
  .topbar {
    padding: 0 20px;
  }
  
  .content-body {
    padding: 24px 20px;
  }
}

@media (max-width: 640px) {
  .auth-card {
    padding: 32px 24px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .user-info {
    display: none;
  }
}
