/* ==========================================================================
   KKCSI File Management System - Premium Dashboard CSS
   Author: kkcsi.com
   ========================================================================== */

:root {
  --fms-primary: #0f172a;
  --fms-sidebar-bg: #1e293b;
  --fms-accent: #2563eb;
  --fms-accent-hover: #1d4ed8;
  --fms-bg: #f8fafc;
  --fms-card-bg: #ffffff;
  --fms-border: #e2e8f0;
  --fms-text-main: #0f172a;
  --fms-text-muted: #64748b;
  --fms-radius: 12px;
  --fms-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --fms-shadow: 0 4px 12px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
  --fms-shadow-md: 0 8px 20px rgba(0, 0, 0, 0.06);
}

html, body.fms-clean-body {
  margin: 0;
  padding: 0;
  background-color: var(--fms-bg);
  font-family: var(--fms-font);
  color: var(--fms-text-main);
  min-height: 100vh;
}

.fms-app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.fms-app-layout * {
  box-sizing: border-box;
}

/* NAVBAR */
.fms-app-navbar {
  background: var(--fms-primary);
  color: #ffffff;
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.fms-navbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.fms-brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--fms-accent), #1d4ed8);
  color: #ffffff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.fms-app-name {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.fms-app-by {
  font-size: 11px;
  color: #94a3b8;
  display: block;
}

.fms-navbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.fms-pdpa-pill {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #34d399;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.fms-dot {
  width: 7px;
  height: 7px;
  background-color: #34d399;
  border-radius: 50%;
  box-shadow: 0 0 8px #34d399;
}

.fms-user-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.2s;
}

.fms-user-meta:hover {
  background: rgba(255, 255, 255, 0.08);
}

.fms-u-avatar {
  width: 36px;
  height: 36px;
  background: var(--fms-accent);
  color: #fff;
  border-radius: 50%;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.fms-u-details {
  display: flex;
  flex-direction: column;
}

.fms-u-name {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
}

.fms-u-role {
  font-size: 11px;
  color: #94a3b8;
  text-transform: capitalize;
}

.fms-btn-nav {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
}
.fms-btn-nav:hover {
  background: rgba(255, 255, 255, 0.18);
}
.fms-btn-accent {
  background: var(--fms-accent);
  border: none;
}
.fms-btn-accent:hover {
  background: var(--fms-accent-hover);
}

/* LOGIN CARD */
.fms-login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 60px 20px;
}

.fms-login-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 48px 40px;
  max-width: 450px;
  width: 100%;
  text-align: center;
  box-shadow: var(--fms-shadow-md);
  border: 1px solid var(--fms-border);
}

.fms-lock-icon {
  width: 68px;
  height: 68px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--fms-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px auto;
}

.fms-login-card h2 {
  margin: 0 0 10px 0;
  font-size: 22px;
  font-weight: 800;
}

.fms-login-card p {
  color: var(--fms-text-muted);
  font-size: 14px;
  margin-bottom: 26px;
}

.fms-btn-large {
  display: inline-block;
  width: 100%;
  background: var(--fms-accent);
  color: #fff;
  padding: 13px 20px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
}

/* DASHBOARD MAIN LAYOUT */
.fms-dashboard-body {
  display: flex;
  flex: 1;
}

.fms-sidebar {
  width: 250px;
  background: var(--fms-sidebar-bg);
  color: #ffffff;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.fms-btn-quick-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: linear-gradient(135deg, var(--fms-accent), #1d4ed8);
  color: #ffffff;
  border: none;
  padding: 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transition: all 0.2s;
}
.fms-btn-quick-upload:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.fms-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fms-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.fms-menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.fms-menu-item.active {
  background: rgba(37, 99, 235, 0.15);
  border-left: 3px solid var(--fms-accent);
  color: #ffffff;
  font-weight: 700;
}

.fms-menu-divider {
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 0.08em;
  padding: 20px 16px 8px 16px;
}

/* MAIN CONTENT */
.fms-main-content {
  flex: 1;
  background: #ffffff;
  padding: 36px 40px;
}

.fms-tab-panel {
  display: none;
}

.fms-tab-panel.active {
  display: block;
}

.fms-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.fms-page-header h2 {
  margin: 0 0 4px 0;
  font-size: 26px;
  font-weight: 800;
  color: var(--fms-primary);
  letter-spacing: -0.02em;
}

.fms-page-header p {
  margin: 0;
  color: var(--fms-text-muted);
  font-size: 14px;
}

/* PROFILE CARD STYLING */
.fms-profile-card {
  background: var(--fms-bg);
  border: 1px solid var(--fms-border);
  border-radius: 14px;
  padding: 32px;
  max-width: 700px;
  box-shadow: var(--fms-shadow);
}

.fms-profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--fms-border);
}

.fms-profile-avatar {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--fms-accent), #1d4ed8);
  color: #ffffff;
  border-radius: 50%;
  font-size: 26px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.fms-profile-name {
  margin: 0 0 4px 0;
  font-size: 22px;
  font-weight: 800;
  color: var(--fms-primary);
}

.fms-profile-email {
  color: var(--fms-text-muted);
  font-size: 14px;
}

.fms-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.fms-profile-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fms-profile-item label {
  font-size: 12px;
  font-weight: 800;
  color: var(--fms-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fms-profile-item span {
  font-size: 15px;
  color: var(--fms-text-main);
  font-weight: 500;
}

/* STATS GRID */
.fms-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.fms-stat-card {
  background: #ffffff;
  border: 1px solid var(--fms-border);
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: var(--fms-shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.fms-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--fms-shadow-md);
}

.fms-stat-card.border-blue { border-top: 4px solid var(--fms-accent); }
.fms-stat-card.border-green { border-top: 4px solid #10b981; }
.fms-stat-card.border-purple { border-top: 4px solid #8b5cf6; }

.fms-stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.fms-stat-header span {
  font-size: 11px;
  font-weight: 800;
  color: var(--fms-text-muted);
  letter-spacing: 0.05em;
}

.fms-stat-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fms-stat-icon.blue { background: rgba(37, 99, 235, 0.1); color: var(--fms-accent); }
.fms-stat-icon.green { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.fms-stat-icon.purple { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }

.fms-stat-card h3 {
  margin: 0 0 4px 0;
  font-size: 28px;
  font-weight: 800;
  color: var(--fms-primary);
}

.fms-stat-card small {
  font-size: 12px;
  color: var(--fms-text-muted);
}

/* TOOLBAR & SEARCH */
.fms-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.fms-search {
  position: relative;
  flex: 1;
  min-width: 280px;
}

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

.fms-search input {
  width: 100%;
  padding: 11px 14px 11px 42px;
  border: 1px solid var(--fms-border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.fms-search input:focus {
  border-color: var(--fms-accent);
}

.fms-filter-group {
  display: flex;
  gap: 12px;
}

.fms-filter-group select {
  padding: 11px 14px;
  border: 1px solid var(--fms-border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  background: #ffffff;
  cursor: pointer;
}

/* TABLE */
.fms-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--fms-border);
  border-radius: 12px;
  box-shadow: var(--fms-shadow);
}

.fms-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.fms-table th {
  background: var(--fms-bg);
  color: var(--fms-text-muted);
  font-weight: 700;
  padding: 14px 18px;
  border-bottom: 1px solid var(--fms-border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.fms-table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--fms-border);
  vertical-align: middle;
}

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

.fms-table tbody tr:hover {
  background-color: rgba(248, 250, 252, 0.9);
}

.fms-loading {
  text-align: center;
  color: var(--fms-text-muted);
  padding: 40px !important;
}

.fms-doc-cell {
  display: flex;
  align-items: center;
  gap: 14px;
}

.fms-doc-icon {
  width: 40px;
  height: 40px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--fms-accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fms-doc-title {
  font-weight: 700;
  color: var(--fms-text-main);
  display: block;
}

.fms-doc-desc {
  font-size: 12px;
  color: var(--fms-text-muted);
}

.fms-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.fms-badge-public { background: #e0f2fe; color: #0369a1; }
.fms-badge-internal { background: #ecfdf5; color: #047857; }
.fms-badge-confidential { background: #fef3c7; color: #b45309; }
.fms-badge-restricted { background: #ffe4e6; color: #be123c; }

/* UPLOAD FORM */
.fms-upload-box {
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 800px;
}

.fms-drop-area {
  border: 2px dashed var(--fms-border);
  border-radius: 14px;
  padding: 50px 24px;
  text-align: center;
  background: var(--fms-bg);
  position: relative;
  cursor: pointer;
  transition: all 0.2s;
}

.fms-drop-area:hover {
  border-color: var(--fms-accent);
  background: rgba(37, 99, 235, 0.03);
}

.fms-drop-area input[type="file"] {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}

.fms-drop-area svg {
  color: var(--fms-accent);
  margin-bottom: 14px;
}

.fms-drop-area h3 {
  margin: 0 0 6px 0;
  font-size: 17px;
  font-weight: 700;
}

.fms-drop-area p {
  margin: 0;
  font-size: 13px;
  color: var(--fms-text-muted);
}

.fms-form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.fms-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fms-field label {
  font-size: 13px;
  font-weight: 700;
}

.fms-field input, .fms-field select, .fms-field textarea {
  padding: 11px 14px;
  border: 1px solid var(--fms-border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.fms-form-footer {
  display: flex;
  justify-content: flex-end;
}

.fms-btn-action {
  background: var(--fms-accent);
  color: #fff;
  border: none;
  padding: 12px 26px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.fms-btn-action:hover {
  background: var(--fms-accent-hover);
}

.fms-btn-cancel {
  background: var(--fms-bg);
  border: 1px solid var(--fms-border);
  color: var(--fms-text-main);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.fms-split-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 28px;
}

.fms-card-form {
  background: var(--fms-bg);
  padding: 28px;
  border-radius: 14px;
  border: 1px solid var(--fms-border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fms-card-form h3 {
  margin: 0 0 6px 0;
  font-size: 17px;
  font-weight: 700;
}

/* MODAL */
.fms-modal {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 99999;
  align-items: center;
  justify-content: center;
}
.fms-modal.active { display: flex; }

.fms-modal-content {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  padding: 28px;
  box-shadow: var(--fms-shadow-md);
}

.fms-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.fms-modal-header h3 { margin: 0; font-size: 19px; font-weight: 700; }

.fms-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--fms-text-muted);
}

.fms-modal-footer {
  margin-top: 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
