/**
 * VOLKK Attendance System - Custom Styles
 */

/* Variables */
:root {
  --sidebar-width: 260px;
  --header-height: 60px;
  --primary-color: #2563eb;
  --primary-dark: #1d4ed8;
  --sidebar-bg: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-active: #3b82f6;
}

/* Global Styles */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #f1f5f9;
  min-height: 100vh;
}

/* Auth Pages */
.auth-page {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-container {
  width: 100%;
  max-width: 420px;
}

.auth-card {
  background: white;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.brand-text {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary-color);
  letter-spacing: -1px;
}

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  z-index: 1040;
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

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

.sidebar-header .brand {
  text-decoration: none;
}

.sidebar-header .brand-text {
  font-size: 1.5rem;
  color: white;
}

.sidebar-close {
  color: white;
  display: none;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 15px 0;
}

.sidebar-nav .nav-link {
  color: var(--sidebar-text);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.sidebar-nav .nav-link i {
  font-size: 1.2rem;
  width: 24px;
  margin-right: 12px;
}

.sidebar-nav .nav-link:hover {
  color: white;
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-nav .nav-link.active {
  color: white;
  background: rgba(59, 130, 246, 0.2);
  border-left-color: var(--sidebar-active);
}

.sidebar-footer {
  padding: 15px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1030;
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.top-header {
  background: white;
  padding: 0 24px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.top-header .btn-link {
  color: #64748b;
  text-decoration: none;
}

.top-header .dropdown-toggle::after {
  display: none;
}

/* Avatar */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
}

/* Cards */
.card {
  border: none;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-header {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 16px 20px;
  font-weight: 600;
}

.card-body {
  padding: 20px;
}

/* Stat Cards */
.stat-card {
  transition: transform 0.2s;
}

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

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

/* Tables */
.table {
  margin-bottom: 0;
}

.table th {
  font-weight: 600;
  color: #64748b;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-top: none;
  padding: 12px 16px;
  background: #f8fafc;
}

.table td {
  padding: 12px 16px;
  vertical-align: middle;
}

/* Badges */
.badge {
  font-weight: 500;
  padding: 5px 10px;
}

/* Footer */
.app-footer {
  background: white;
  border-top: 1px solid #e2e8f0;
}

/* Buttons */
.btn-primary {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

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

/* Form Controls */
.form-control:focus,
.form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Alerts */
.alert {
  border: none;
  border-radius: 8px;
}

/* Mobile Responsive */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .sidebar.show + .sidebar-overlay {
    display: block;
  }

  .sidebar-close {
    display: block;
  }

  .main-content {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: block !important;
  }
}

@media (min-width: 992px) {
  .sidebar-toggle {
    display: none !important;
  }
}

/* Placeholder Views */
.placeholder-view {
  min-height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #64748b;
}

.placeholder-view i {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Layout */
.layout {
  display: flex;
  min-height: 100vh;
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0;
  color: #1e293b;
}

.page-actions {
  display: flex;
  gap: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.8125rem;
}

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

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

.btn-secondary {
  background: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}

.btn-secondary:hover {
  background: #e2e8f0;
  color: #334155;
}

.btn-success {
  background: #10b981;
  color: white;
}

.btn-warning {
  background: #f59e0b;
  color: white;
}

.btn-danger {
  background: #ef4444;
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
  color: white;
}

/* Cards */
.card {
  background: white;
  border: none;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 16px;
}

.card-header {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 16px 20px;
}

.card-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.card-body {
  padding: 20px;
}

/* Grids */
.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 991.98px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  font-weight: 600;
  color: #64748b;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  background: #f8fafc;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.table td {
  padding: 12px 16px;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
}

.table th a {
  color: inherit;
  text-decoration: none;
}

.table th a:hover {
  color: var(--primary-color);
}

.table td.actions {
  white-space: nowrap;
}

.table td.actions .btn {
  margin-right: 4px;
}

.table code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8125rem;
}

/* Badges */
.badge {
  display: inline-block;
  font-weight: 500;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 20px;
}

.badge-success {
  background: #dcfce7;
  color: #166534;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-info {
  background: #e0f2fe;
  color: #0369a1;
}

.badge-role-super-admin {
  background: #fae8ff;
  color: #86198f;
}

.badge-role-hr {
  background: #e0f2fe;
  color: #0369a1;
}

.badge-role-accountant {
  background: #ecfdf5;
  color: #047857;
}

.badge-role-employee {
  background: #f1f5f9;
  color: #475569;
}

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

.form-group label {
  display: block;
  font-weight: 500;
  font-size: 0.875rem;
  color: #374151;
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input[readonly] {
  background: #f9fafb;
  cursor: not-allowed;
}

.form-group .error-text {
  color: #dc2626;
  font-size: 0.8125rem;
  margin-top: 4px;
}

.form-group .form-hint {
  color: #6b7280;
  font-size: 0.8125rem;
  margin-top: 4px;
}

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

@media (max-width: 767.98px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.form-section {
  margin-bottom: 32px;
}

.form-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 24px;
}

.filter-form .form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.filter-form .form-group {
  margin-bottom: 0;
  min-width: 150px;
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.875rem;
}

.alert-success {
  background: #dcfce7;
  color: #166534;
}

.alert-danger {
  background: #fee2e2;
  color: #991b1b;
}

.alert-info {
  background: #e0f2fe;
  color: #0369a1;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
}

.pagination-info {
  color: #6b7280;
  font-size: 0.875rem;
}

.pagination-links {
  display: flex;
  gap: 4px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #6b7280;
}

.empty-state p {
  margin-bottom: 16px;
}

/* Detail Grid */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6b7280;
  font-weight: 500;
}

.detail-value {
  font-size: 0.9375rem;
  color: #111827;
}

/* Stats Row */
.stats-row {
  display: flex;
  gap: 24px;
}

.stat-item {
  text-align: center;
  padding: 16px 24px;
  border-radius: 8px;
  background: #f9fafb;
}

.stat-item.stat-success {
  background: #dcfce7;
}

.stat-item.stat-danger {
  background: #fee2e2;
}

.stat-item.stat-info {
  background: #e0f2fe;
}

.stat-item.stat-secondary {
  background: #f1f5f9;
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: #111827;
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #6b7280;
  margin-top: 4px;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Code Block */
.code-block {
  background: #1e293b;
  color: #e2e8f0;
  padding: 16px;
  border-radius: 8px;
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 0.8125rem;
  overflow-x: auto;
  white-space: pre;
}

/* Error List */
.error-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.error-list li {
  padding: 8px 12px;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 4px;
  margin-bottom: 4px;
  font-size: 0.875rem;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.125rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #6b7280;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: #111827;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
}

/* Utility Classes */
.mb-4 {
  margin-bottom: 16px;
}

.mt-4 {
  margin-top: 16px;
}

.text-muted {
  color: #6b7280;
}

.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Mobile Responsive Overrides */
@media (max-width: 991.98px) {
  .main-content {
    margin-left: 0;
    padding: 16px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .stats-row {
    flex-wrap: wrap;
  }
}
