/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
  --primary: #3366ff;
  --primary-dark: #0043a9;
  --primary-light: #3380f4;
  --secondary: #425466;
  --text-primary: #242c3a;
  --text-dark: #12171e;
  --bg: #f0f2f8;
  --paper: #ffffff;
  --success: #00ac69;
  --warning: #f4a100;
  --error: #ff413a;
}

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

body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  padding: 20px;
}

/* Container untuk halaman form (login, register, edit, dll) */
.container {
  max-width: 500px;
  margin: 40px auto;
  background: var(--paper);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

/* Container KHUSUS untuk dashboard & halaman dengan tabel */
.container-dashboard {
  max-width: 100%;
  margin: 20px auto;
  background: var(--paper);
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  padding: 0 10px;
}

.card-header {
  font-weight: 600 !important;
  font-size: 15px;
  padding: 20px !important;
  background: var(--primary);
  color: white;
  text-align: center;
}

.card-body {
  padding: 30px !important;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 14px;
  color: var(--text-dark);
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  transition: border-color 0.3s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(51, 102, 255, 0.15);
}

.btn {
  display: inline-flex;          /* ✅ Flex untuk align center */
  align-items: center;           /* ✅ Vertikal center */
  justify-content: center;       /* ✅ Horizontal center */
  text-align: center;            /* ✅ Backup untuk teks */
  padding: 12px 20px;            /* ✅ Padding horizontal opsional */
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  text-decoration: none;         /* ✅ Hilangkan underline di <a> */
  transition: background 0.3s;
  min-width: 20px;              /* ✅ Lebar minimum agar konsisten */
  box-sizing: border-box;
  text-decoration: none;
}

/* Jika ingin full-width di form, buat class khusus */
.btn-block {
  display: flex;
  width: 100%;
}

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

.text-center {
  text-align: center;
}

.text-muted {
  color: #6c757d;
  font-size: 14px;
  margin-top: 15px;
}

.text-muted a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.text-muted a:hover {
  text-decoration: underline;
}

.alert {
  padding: 12px;
  margin-bottom: 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}

.alert-danger {
  background: #ffebee;
  color: var(--error);
  border: 1px solid var(--error);
}

/* Breadcrumb */
.icon-breadcrumb {
  margin-right: 5px;
}

.link-breadcrumb {
  font-size: 0.75rem;
  display: flex;
  text-decoration: none;
  color: var(--secondary);
}

.link-breadcrumb:hover {
  color: var(--primary);
}

/* Utility Classes */
.f-right {
  float: right;
}

.p-0 {
  padding: 0 !important;
}

.p-20 {
  padding: 20px !important;
}

/* Scrollbar */
.ps {
  overflow: hidden !important;
  overflow-anchor: none;
  -ms-overflow-style: none;
  touch-action: auto;
  -ms-touch-action: auto;
}

.ps__rail-y {
  width: 8px !important;
  right: 4px !important;
  opacity: 0.5 !important;
}

.ps__thumb-y {
  background-color: var(--primary) !important;
  width: 6px !important;
  border-radius: 3px !important;
}

/* RESPONSIF UMUM */
@media (max-width: 576px) {
  .container {
    margin: 10px;
    padding: 0;
  }
  .card-body {
    padding: 20px !important;
  }
  body {
    padding: 10px;
  }
}

/* === DASHBOARD & TABEL === */

.app-header {
  background: #0056b3;
  color: white;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  flex-wrap: wrap;
  gap: 10px;
}

.app-title {
  font-size: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
}

.app-title img {
  width: 24px;
  height: 24px;
  margin-right: 8px;
}

.nav-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-primary {
  background: #ff9f40;
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}

.btn-primary:hover {
  background: #e68a37;
}

.breadcrumb {
  padding: 10px 20px;
  background: #f8f9fa;
  font-size: 13px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: #0056b3;
  text-decoration: none;
  margin: 0 5px;
}

.breadcrumb span {
  color: #6c757d;
}

.folder-section {
  margin: 20px 0;
  padding: 15px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.folder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 2px solid #eee;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 10px;
}

.folder-name {
  font-size: 18px;
  font-weight: 600;
  color: #0056b3;
}

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

/* Tabel Responsif */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 15px 0;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  background: white;
}

.task-table {
  width: 100%;
  min-width: 800px;
  border-collapse: collapse;
  font-size: 14px;
}

.task-table th {
  background: #0056b3;
  color: white;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 10;
}

.task-table td {
  padding: 10px 12px;
  border-top: 1px solid #eee;
  vertical-align: top;
  word-break: break-word;
}

.task-row.completed td {
  color: #888 !important;
  text-decoration: line-through;
  background-color: #f9f9f9;
}

.task-row.completed td:first-child::after {
  content: "✓";
  color: green;
  font-weight: bold;
  margin-left: 5px;
}

/* Ikon Task */
.task-icons {
  display: flex;
  gap: 6px;
  align-items: center;
}

.icon-star { color: gold; font-size: 16px; }
.icon-check { color: green; font-size: 16px; }
.icon-bug { color: red; font-size: 16px; }
.icon-research { color: blue; font-size: 16px; }

/* Badge */
.priority-badge,
.status-badge {
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: bold;
  color: white;
  display: inline-block;
}

/* Subtask */
.subtask-list {
  margin-top: 12px;
  padding-left: 20px;
  border-left: 2px solid #eee;
}

.subtask-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  font-size: 13px;
}

.subtask-row input[type="checkbox"] {
  transform: scale(1.1);
}

.subtask-row > span:last-child {
  margin-left: auto;
  white-space: nowrap;
  color: #666;
}

/* Stats Footer */
.stats-footer {
  padding: 15px 20px;
  background: #f8f9fa;
  border-top: 1px solid #ddd;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* === RESPONSIF DASHBOARD === */

@media (max-width: 768px) {
  .app-header {
    padding: 10px 15px;
  }
  
  .btn-primary {
    padding: 6px 10px;
    font-size: 12px;
  }
  
  .folder-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .folder-actions {
    width: 100%;
    justify-content: flex-start;
  }
  
  /* Sembunyikan kolom non-esensial */
  .task-table th:nth-child(3), /* Folder */
  .task-table td:nth-child(3),
  .task-table th:nth-child(6), /* Duration */
  .task-table td:nth-child(6),
  .task-table th:nth-child(7), /* Tag */
  .task-table td:nth-child(7) {
    display: none;
  }
  
  .task-table th:nth-child(2), /* Task */
  .task-table td:nth-child(2) {
    min-width: 250px;
  }
  
  .stats-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .subtask-list {
    padding-left: 15px;
  }
}

@media (max-width: 480px) {
  .task-table th:nth-child(4), /* Priority */
  .task-table td:nth-child(4),
  .task-table th:nth-child(8), /* Status */
  .task-table td:nth-child(8) {
    display: none;
  }
  
  .task-table th:nth-child(2),
  .task-table td:nth-child(2) {
    min-width: 200px;
  }
  
  .subtask-row {
    flex-wrap: wrap;
    font-size: 12px;
  }
  
  .subtask-row > span:last-child {
    width: 100%;
    text-align: right;
    margin-left: 0;
    margin-top: 4px;
  }
  
  .subtask-row button {
    font-size: 12px;
  }
}

/* === GAYA TAMBAHAN UNTUK TASK & SUBTASK === */

.task-title-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.task-title-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  font-weight: 600;
}

.task-title-link:hover {
  color: #0056b3;
  text-decoration: underline;
}

/* Subtask Actions */
.subtask-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}

.btn-sm {
  padding: 2px 6px;
  font-size: 11px;
  border-radius: 3px;
  text-decoration: none;
  display: inline-block;
}

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

.btn-sm {
  background: #ffc107;
  color: #000;
}

.subtask-duration {
  color: #6c757d;
  font-size: 12px;
  margin-left: 8px;
}

.btn-success { 
  background: #28a745; 
  color: white; 
  border: none;
  cursor: pointer;
}

.btn-danger { 
  background: #dc3545; 
  color: white; 
  border: none;
  cursor: pointer;
}

/* === MODAL === */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  padding: 20px;
  border-radius: 8px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  text-align: center;
}

.modal-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

.modal-actions .btn {
  padding: 8px 16px;
  font-size: 14px;
  width: auto;
}

/* === Tombol Kecil Form === */
.btn-small {
  background: #6c757d;
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-small:hover {
  background: #5a6268;
}

/* Scrollbar kustom untuk tabel */
.table-responsive::-webkit-scrollbar {
  height: 8px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: #0056b3;
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-track {
  background: #f1f1f1;
}

/* --- SUBTASK DI task/view.php --- */
.subtask-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 6px 0;
    border-bottom: 1px solid #eee;
    gap: 12px;
}

.subtask-label {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0; /* Penting untuk mencegah overflow */
    flex-wrap: nowrap; /* Jangan wrap ke baris baru */
}

.subtask-label input[type="checkbox"] {
    flex-shrink: 0;
}

.subtask-title {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
}

.subtask-duration {
    color: #666;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 8px;
}

.subtask-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    white-space: nowrap; /* Pastikan tombol tidak wrap */
}

/* Tombol kecil */
.btn-sm {
    padding: 2px 6px;
    font-size: 11px;
    border-radius: 3px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: auto;
    white-space: nowrap;
}

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

.btn-sm {
    background: #ffc107;
    color: #000;
}

.timer-btn.btn-sm {
    padding: 2px 8px;
}

@media (max-width: 480px) {
    .subtask-item {
        flex-wrap: wrap;
    }
    .subtask-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 4px;
    }
}

/* Folder milik sendiri */
.folder-section.owner {
    background: #f3f1f1;
    border-left: 4px solid #007bff;
}

/* Folder kolaborasi */
.folder-section.collaborator {
    background: #e8fae5ef;
    border-left: 4px solid #28a745;
    position: relative;
}

/* Badge kolaborasi */
.folder-section.collaborator .folder-name::after {
    content: "👥";
    margin-left: 8px;
    font-size: 14px;
    color: #28a745;
}

/* Tooltip untuk kolaborasi (opsional) */
.folder-section.collaborator .folder-name {
    position: relative;
}

.folder-section.collaborator .folder-name:hover::before {
    content: "Kolaborasi";
    position: absolute;
    bottom: 100%;
    left: 0;
    background: #000;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 10;
}