/**
 * Main Application Stylesheet (css/style.css)
 * Premium Glassmorphism UI & Modern Responsive Design
 */

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

/* --- Theme Variables --- */
:root {
  /* Dark Mode Default Values */
  --bg: #0d0f12;
  --bg-gradient: linear-gradient(135deg, #0d0f12 0%, #151922 100%);
  --sidebar-bg: rgba(18, 22, 30, 0.7);
  --glass-card-bg: rgba(26, 32, 44, 0.45);
  --glass-card-border: rgba(255, 255, 255, 0.07);
  --glass-card-hover-border: rgba(255, 255, 255, 0.15);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #00f5d4;
  --accent-rgb: 0, 245, 212;
  --accent-hover: #00e0c2;
  
  --success: #00e676;
  --danger: #ff1744;
  --warning: #ffea00;
  --info: #29b6f6;
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --sidebar-width: 250px;
}

body.light-mode {
  /* Light Mode Values */
  --bg: #f3f4f6;
  --bg-gradient: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  --sidebar-bg: rgba(255, 255, 255, 0.7);
  --glass-card-bg: rgba(255, 255, 255, 0.55);
  --glass-card-border: rgba(0, 0, 0, 0.08);
  --glass-card-hover-border: rgba(0, 0, 0, 0.15);
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --accent: #008080;
  --accent-rgb: 0, 128, 128;
  --accent-hover: #006666;
  
  --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

/* --- Global Resets & Layout --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow: hidden;
  transition: var(--transition);
}

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

/* --- Main Layout Grid --- */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--glass-card-border);
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: var(--transition);
  z-index: 10;
  flex-shrink: 0;
}

.sidebar.collapsed {
  width: 70px;
}

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--glass-card-border);
  overflow: hidden;
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--accent);
  flex-shrink: 0;
}

.sidebar-title {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.025em;
  white-space: nowrap;
  transition: var(--transition);
}

.sidebar.collapsed .sidebar-title {
  opacity: 0;
  pointer-events: none;
}

.sidebar-menu {
  list-style: none;
  padding: 15px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  flex-grow: 1;
}

.sidebar-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 15px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.sidebar-menu-item:hover, .sidebar-menu-item.active {
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
}

.sidebar-menu-item i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar.collapsed .sidebar-menu-item span {
  display: none;
}

/* --- Main Content Section --- */
.main-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
}

/* --- Header Bar --- */
.header {
  height: 70px;
  border-bottom: 1px solid var(--glass-card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 5;
}

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

.btn-toggle-sidebar {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 5px;
  border-radius: 4px;
}

.btn-toggle-sidebar:hover {
  color: var(--accent);
}

.search-container {
  position: relative;
  width: 260px;
}

.search-container input {
  width: 100%;
  padding: 8px 12px 8px 35px;
  border-radius: 20px;
  border: 1px solid var(--glass-card-border);
  background: rgba(0, 0, 0, 0.15);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  transition: var(--transition);
}

.search-container input:focus {
  border-color: var(--accent);
  width: 320px;
}

.search-container .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.search-results-dropdown {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  width: 100%;
  background: var(--sidebar-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-card-border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-height: 250px;
  overflow-y: auto;
  z-index: 100;
  padding: 5px;
}

.search-result-item {
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  transition: var(--transition);
}

.search-result-item:hover {
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
}

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

.header-icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.15rem;
  cursor: pointer;
  position: relative;
}

.header-icon-btn:hover {
  color: var(--accent);
}

/* --- Panel Scroll Wrapper --- */
.content-body {
  flex-grow: 1;
  overflow-y: auto;
  padding: 30px;
  height: calc(100vh - 70px);
}

.view-panel {
  display: flex;
  flex-direction: column;
  height: auto;
}

.hidden {
  display: none !important;
}

/* --- Glass Cards System --- */
.glass-card {
  background: var(--glass-card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-card-border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.glass-card:hover {
  border-color: var(--glass-card-hover-border);
}

/* --- Panel Header & Typography --- */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.panel-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

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

/* --- Button Styling --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}

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

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 15px rgba(var(--accent-rgb), 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--glass-card-border);
}

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

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

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

.btn-icon {
  padding: 6px;
  border-radius: 6px;
  color: var(--text-secondary);
  background: none;
  border: none;
}

.btn-icon:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.btn-small {
  padding: 5px 10px;
  font-size: 0.75rem;
}

/* --- KPI Grid & Cards --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 25px;
}

.kpi-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100px;
}

.kpi-card:hover {
  transform: translateY(-2px);
}

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

.kpi-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-value {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 5px;
}

/* --- Table Controls & Tables --- */
.table-container {
  overflow: hidden;
}

.table-header-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--glass-card-border);
  margin-bottom: 15px;
  gap: 15px;
  flex-wrap: wrap;
}

.filter-controls {
  display: flex;
  gap: 10px;
}

.filter-controls select, .form-group select, .form-group input, .form-group textarea {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-card-border);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 8px 12px;
  outline: none;
  font-family: inherit;
  font-size: 0.85rem;
  transition: var(--transition);
}

.filter-controls select:focus, .form-group select:focus, .form-group input:focus, .form-group textarea:focus {
  border-color: var(--accent);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th, .data-table td {
  padding: 12px 15px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--glass-card-border);
  vertical-align: middle;
}

.data-table th {
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  background: rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 2;
}

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

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
}

.badge-outline {
  border: 1px solid var(--glass-card-border);
  background: none;
}

.status-badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-completed { background: rgba(0, 230, 118, 0.15); color: #00e676; }
.status-active { background: rgba(33, 150, 243, 0.15); color: #2196f3; }
.status-pending { background: rgba(255, 152, 0, 0.15); color: #ff9800; }
.status-on-hold { background: rgba(156, 39, 176, 0.15); color: #9c27b0; }

.prio-high { background: rgba(255, 23, 68, 0.15); color: #ff1744; }
.prio-medium { background: rgba(255, 152, 0, 0.15); color: #ff9800; }
.prio-low { background: rgba(120, 144, 156, 0.15); color: #78909c; }

/* --- Modals System --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: var(--transition);
}

.modal-box {
  width: 500px;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--glass-card-border);
  padding-bottom: 12px;
  margin-bottom: 15px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--danger);
}

/* --- Form Fields --- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 15px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--glass-card-border);
  padding-top: 15px;
}

/* --- Toast System --- */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}

.toast {
  background: rgba(18, 22, 30, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-card-border);
  border-radius: 8px;
  padding: 12px 18px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 400px;
  transform: translateY(50px);
  opacity: 0;
  transition: var(--transition);
}

.toast-icon {
  font-size: 1.25rem;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-success .toast-icon { color: var(--success); }

.toast-error { border-left: 4px solid var(--danger); }
.toast-error .toast-icon { color: var(--danger); }

.toast-info { border-left: 4px solid var(--info); }
.toast-info .toast-icon { color: var(--info); }

.toast-content {
  font-size: 0.85rem;
  font-weight: 500;
  flex-grow: 1;
}

.toast-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.1rem;
}

/* --- Confirm modal styles --- */
.confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(5px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm-box {
  width: 350px;
  text-align: center;
}

.confirm-box h3 {
  margin-bottom: 8px;
}

.confirm-box p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.confirm-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* --- Animations --- */
.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

.fade-out {
  animation: fadeOut 0.3s ease forwards;
}

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

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

.fade-in.toast {
  transform: translateY(0);
  opacity: 1;
}

.fade-out.toast {
  transform: translateY(-20px);
  opacity: 0;
}

/* Delay Animations for clean loads */
.delay-1 { animation-delay: 0.08s; }
.delay-2 { animation-delay: 0.16s; }
.delay-3 { animation-delay: 0.24s; }
.delay-4 { animation-delay: 0.32s; }
.delay-5 { animation-delay: 0.40s; }
.delay-6 { animation-delay: 0.48s; }
.delay-7 { animation-delay: 0.56s; }

/* --- Special Module Components & Timelines --- */
.text-truncate-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.code-font {
  font-family: 'Courier New', Courier, monospace;
}

.text-gradient {
  background: linear-gradient(135deg, var(--accent) 0%, #00bcd4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.chart-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.font-green { color: var(--success); }
.font-red { color: var(--danger); }
.font-bold { font-weight: 700; }

.checklist-progress-bar {
  background: linear-gradient(90deg, var(--accent) 0%, #00e676 100%);
  height: 6px;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.task-completed-row {
  opacity: 0.75;
  background: rgba(0, 0, 0, 0.1);
}

.timeline-log-container::-webkit-scrollbar,
.sidebar-menu::-webkit-scrollbar,
body::-webkit-scrollbar,
textarea::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.01);
}

::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.15);
}

/* --- Responsive Layout Breakpoints --- */
@media(max-width: 1024px) {
  .dashboard-body-grid {
    grid-template-columns: 1fr !important;
  }
  .sidebar {
    width: 70px;
  }
  .sidebar .sidebar-title, .sidebar .sidebar-menu-item span {
    display: none;
  }
}

@media(max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .profile-detail-grid {
    grid-template-columns: 1fr !important;
  }
  .profile-timeline-pane {
    border-left: none !important;
    padding-left: 0 !important;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 20px;
    margin-top: 20px;
  }
  .header {
    padding: 0 15px;
  }
  .content-body {
    padding: 15px;
  }
}
