/* Professional Corporate CSS - Clean, flat, no gradients or animations */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
    background-color: #f5f6f8; /* flat neutral background */
    color: #212529;
    line-height: 1.6;
}

/* Layout */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header (legacy simple header blocks if used elsewhere) */
.app-header {
    background-color: #2c3e50;
    color: #fff;
    padding: 1rem 0;
    border-bottom: 1px solid #22303d;
}

.app-header h1 { font-size: 1.5rem; font-weight: 600; text-align: center; }
.app-header .subtitle { font-size: 0.9rem; text-align: center; opacity: 0.9; }

/* Cards and Panels */
.card,
.content-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.card-header,
.content-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 1.25rem;
}

.card-body,
.content-body { padding: 1.25rem; }

/* Simple page actions */
.page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Page header and breadcrumb layout */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.page-header.compact { padding-bottom: 0.5rem; border-bottom: 1px solid #e5e7eb; }
.page-header .breadcrumb { display: flex; align-items: center; gap: 0.4rem; color: #6c757d; }
.page-header .breadcrumb a { color: #2c3e50; text-decoration: none; }
.page-header .breadcrumb .separator { color: #adb5bd; }
.page-header .page-actions { margin-left: auto; }

/* Typography */
h1, h2 { color: #2c3e50; margin-bottom: 1rem; font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }

h3 { color: #2c3e50; margin-bottom: 0.75rem; font-size: 1.1rem; font-weight: 600; }
h4 { color: #2c3e50; margin-bottom: 0.5rem; font-size: 1rem; font-weight: 600; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-row { display: flex; gap: 1rem; margin-bottom: 1rem; }
.form-row .form-group { flex: 1; margin-bottom: 0; }

label { display: block; margin-bottom: 0.5rem; color: #2c3e50; font-weight: 500; font-size: 0.9rem; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
select,
textarea {
    width: 100%;
    padding: 0.6rem 0.7rem;
    border: 1px solid #ced4da;
    font-size: 0.95rem;
    background-color: #fff;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #495057;
    box-shadow: 0 0 0 2px rgba(73, 80, 87, 0.08);
}

textarea { resize: vertical; min-height: 80px; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.6rem 1rem;
    font-size: 0.92rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    background-color: #e9ecef;
    color: #212529;
}

.btn:hover { filter: brightness(0.97); }

.btn-primary { background-color: #2c3e50; color: #fff; border-color: #2c3e50; }
.btn-secondary { background-color: #6c757d; color: #fff; border-color: #6c757d; }
.btn-danger { background-color: #dc3545; color: #fff; border-color: #dc3545; }
.btn-success { background-color: #28a745; color: #fff; border-color: #28a745; }
.btn-warning { background-color: #ffc107; color: #212529; border-color: #ffc107; }
.btn-info { background-color: #17a2b8; color: #fff; border-color: #17a2b8; }

input[type="submit"].btn { width: 100%; }
.btn-small { padding: 0.35rem 0.6rem; font-size: 0.85rem; margin-right: 0.25rem; }

/* Alerts */
.error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; padding: 0.85rem; margin-bottom: 1rem; border-radius: 6px; }
.success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; padding: 0.85rem; margin-bottom: 1rem; border-radius: 6px; }
.warning { background-color: #fff3cd; color: #856404; border: 1px solid #ffeaa7; padding: 0.85rem; margin-bottom: 1rem; border-radius: 6px; }
.info { background-color: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; padding: 0.85rem; margin-bottom: 1rem; border-radius: 6px; }

/* Sections */
.form-section { background: #fff; border-radius: 8px; margin-bottom: 1rem; border: 1px solid #e5e7eb; }
.form-section-header { background: #f8f9fa; padding: 0.9rem 1rem; border-bottom: 1px solid #e5e7eb; display: flex; align-items: center; justify-content: space-between; }
.form-section-title { font-weight: 600; color: #2c3e50; margin: 0; font-size: 1rem; }
.form-section-body { padding: 1rem; background: #fff; }

/* Tables (generic) */
.table,
.reports-table { width: 100%; border-collapse: collapse; background: #fff; }

.table th, .table td,
.reports-table th, .reports-table td {
    padding: 0.7rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
    font-size: 0.95rem;
}

.table th, .reports-table th { background-color: #f8f9fa; color: #2c3e50; font-weight: 600; }
.table-hover tbody tr:hover, .reports-table tbody tr:hover { background-color: #f4f6f8; }

.reports-table-container { overflow-x: auto; border: 1px solid #e5e7eb; border-radius: 6px; background: #fff; }

.actions-cell { white-space: nowrap; }

/* Button variants for row actions */
.btn-export { background-color: #28a745; color: #fff; border-color: #28a745; }
.btn-view { background-color: #0d6efd; color: #fff; border-color: #0d6efd; }
.btn-edit { background-color: #ffc107; color: #212529; border-color: #ffc107; }
.btn-delete { background-color: #dc3545; color: #fff; border-color: #dc3545; }

.no-data { text-align: center; color: #6c757d; font-style: italic; padding: 1.5rem; }

/* Utility */
.text-center { text-align: center; }
.text-muted { color: #6c757d; }
.mb-4 { margin-bottom: 1.25rem; }
.row { display: flex; flex-wrap: wrap; gap: 1rem; }
.col { flex: 1; min-width: 250px; }

/* Helpers for controls in headers */
.table-controls { display: flex; gap: 0.5rem; align-items: center; }
.table-responsive { 
    width: 100%; 
    overflow-x: auto; 
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 1rem;
}

/* Better responsive table styling */
.table-responsive table {
    min-width: 100%;
    white-space: nowrap;
}

.table-responsive td, .table-responsive th {
    min-width: 80px;
    padding: 0.5rem 0.35rem;
}

/* Specific styling for progress report table */
.progress-table {
    font-size: 0.8rem;
}

.progress-table th, .progress-table td {
    min-width: 90px;
    padding: 0.4rem 0.25rem;
    text-align: center;
    vertical-align: middle;
}

.progress-table input[type="date"] {
    width: 110px;
    font-size: 0.75rem;
    padding: 0.25rem;
}

.progress-table input[type="checkbox"] {
    transform: scale(0.9);
}

.progress-table select {
    width: 50px;
    font-size: 0.75rem;
    padding: 0.2rem;
}

.progress-table input[type="text"] {
    min-width: 120px;
    font-size: 0.75rem;
    padding: 0.25rem;
}

/* Button sizes */
.btn-sm { padding: 0.35rem 0.6rem; font-size: 0.85rem; }

/* Responsive */
@media (max-width: 768px) {
    .container { padding: 1rem; }
    .form-row { flex-direction: column; }
    .row { flex-direction: column; }
    .content-body, .form-section-body { padding: 0.85rem; }
}

/* Print */
@media print {
    body { background: #fff; color: #000; font-family: Arial, sans-serif; font-size: 12px; line-height: 1.4; }
    .export-header { text-align: center; margin-bottom: 20px; border-bottom: 2px solid #000; padding-bottom: 10px; }
    .export-table { width: 100%; border-collapse: collapse; margin-bottom: 15px; }
    .export-table th, .export-table td { border: 1px solid #000; padding: 5px; text-align: left; vertical-align: top; }
    .export-table th { background: #f0f0f0; font-weight: bold; }
    .no-print { display: none; }
}

/* ------------------------------------------------------------------ */
/* Sidebar Layout: fixed left, collapsible, with main content offset.  */
/* ------------------------------------------------------------------ */
/* Body flag still used for pages with/without sidebar */
body.has-sidebar { min-height: 100vh; }

/* Sidebar container */
body.has-sidebar .sidebar {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  width: 240px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  overflow-y: auto;
  z-index: 20;
  transition: width .2s ease, transform .2s ease;
}

/* Main content offset */
body.has-sidebar .main-container { margin-left: 240px; }

/* Collapsed width */
body.has-sidebar.sidebar-collapsed .sidebar { width: 64px; }
body.has-sidebar.sidebar-collapsed .main-container { margin-left: 64px; }

/* Sidebar content */
.sidebar-header { padding: 0.9rem 1rem; border-bottom: 1px solid #e5e7eb; color: #2c3e50; font-weight: 600; }
.sidebar-nav { display: flex; flex-direction: column; padding: 0.5rem; gap: 2px; }
.sidebar-link, .sidebar-link:visited { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.65rem; border-radius: 6px; color: #2c3e50; text-decoration: none; }
.sidebar-link:hover { background: #f4f6f8; }
.sidebar-link.active { background: #eef2f5; font-weight: 600; }
.nav-icon { width: 20px; text-align: center; opacity: 0.8; }

/* Collapse behavior: hide labels when collapsed */
body.has-sidebar.sidebar-collapsed .nav-label,
body.has-sidebar.sidebar-collapsed .sidebar-title { display: none; }
body.has-sidebar.sidebar-collapsed .nav-icon { width: 100%; }

/* Main content area */
.main-container { display: flex; flex-direction: column; min-width: 0; }
.top-bar { background:#fff; border-bottom:1px solid #e5e7eb; padding:0.75rem 1rem; display:flex; align-items:center; justify-content:space-between; gap:0.75rem; flex-wrap:wrap; position: sticky; top: 0; z-index: 10; }
.top-bar-left { display:flex; align-items:center; gap:0.6rem; }

/* Ensure previous container spacing works inside main */
.main-container .container { padding: 1rem; }

/* Mobile: sidebar overlays content and is hidden when collapsed */
@media (max-width: 768px) {
  body.has-sidebar .main-container { margin-left: 0; }
  /* hide sidebar completely when collapsed on mobile */
  body.has-sidebar.sidebar-collapsed .sidebar { transform: translateX(-100%); }
}

/* Status Badges */
.badge,
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge { background-color: #e5e7eb; color: #374151; }

.status-badge.status-active { background-color: #dcfce7; color: #166534; }
.status-badge.status-inactive { background-color: #fef3c7; color: #92400e; }
.status-badge.status-terminated { background-color: #fee2e2; color: #dc2626; }
.status-badge.status-stock { background-color: #dbeafe; color: #1e40af; }
.status-badge.status-equipment { background-color: #f3e8ff; color: #7c3aed; }
