/* ============================================
   Finance Blog Admin Panel - Global Styles
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* --- Base Layout --- */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f5f7fa;
  min-height: 100vh;
}

body.login-page {
  background: #e8f4f8;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Navbar --- */
.navbar {
  background: #f5f5f5;
  color: #333;
  padding: 15px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid #e0e0e0;
}

.navbar h1 {
  font-size: 24px;
  color: #333;
}

.navbar-right {
  display: flex;
  gap: 20px;
  align-items: center;
}

.admin-info {
  font-size: 14px;
  color: #666;
}

.logout-btn {
  background: #f5f5f5;
  color: #333;
  padding: 8px 16px;
  border: 1px solid #ddd;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.3s;
}

.logout-btn:hover {
  background: #e0e0e0;
}

/* --- Main Wrapper / Sidebar --- */
.main-wrapper {
  display: flex;
}

.sidebar {
  width: 250px;
  background: white;
  border-right: 1px solid #e0e0e0;
  padding: 0;
  min-height: calc(100vh - 70px);
}

.menu-item {
  padding: 15px 20px;
  color: #333;
  text-decoration: none;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s, border-left 0.2s;
  border-left: 4px solid transparent;
  display: block;
}

.menu-item:hover {
  background: #f5f5f5;
  border-left-color: #667eea;
}

.menu-item.active {
  background: #e8f4f8;
  color: #667eea;
  border-left-color: #667eea;
  font-weight: 600;
}

.content-area {
  flex: 1;
  padding: 20px 40px 40px;
}

/* --- Page Header / Title --- */
.page-header,
.page-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.page-header h2,
.page-title h2 {
  font-size: 28px;
  color: #333;
}

/* --- Buttons --- */
.btn-add {
  background: #667eea;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s;
}

.btn-add:hover {
  background: #5568d3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* --- Table Search Bar --- */
.table-search-bar {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-input {
  width: 280px;
  padding: 9px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.btn-search {
  padding: 9px 18px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-search:hover {
  background: #5568d3;
}

.btn-back {
  background: #f5f5f5;
  color: #333;
  padding: 10px 20px;
  border: 1px solid #ddd;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.3s;
}

.btn-back:hover {
  background: #e0e0e0;
}

.btn-save {
  background: #667eea;
  color: white;
  padding: 12px 30px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.3s;
}

.btn-save:hover {
  background: #5568d3;
}

.btn-cancel {
  background: #f5f5f5;
  color: #333;
  padding: 12px 30px;
  border: 1px solid #ddd;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.3s;
}

.btn-cancel:hover {
  background: #e0e0e0;
}

/* --- Tables --- */
.table-container {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: #f9f9f9;
  border-bottom: 2px solid #e0e0e0;
}

th {
  padding: 15px;
  text-align: left;
  font-weight: 600;
  color: #333;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  padding: 12px 15px;
  border-bottom: 1px solid #e0e0e0;
  color: #666;
  font-size: 14px;
}

tr:hover {
  background: #f9f9f9;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.btn-view,
.btn-edit,
.btn-delete {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-view {
  background: #e8f5e9;
  color: #27ae60;
  border: 1px solid #a9dfbf;
}

.btn-view:hover {
  background: #d5f0da;
}

.btn-edit {
  background: #e8f4f8;
  color: #667eea;
  border: 1px solid #b3d9e8;
}

.btn-edit:hover {
  background: #d0ecf4;
}

.btn-delete {
  background: #fadbd8;
  color: #e74c3c;
  border: 1px solid #f5b7b1;
}

.btn-delete:hover {
  background: #f5ceaa;
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: #999;
}

.empty-state p {
  margin-bottom: 20px;
}

/* --- Forms --- */
.form-container {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  padding: 30px;
}

.form-container.narrow {
  max-width: 600px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #333;
  font-weight: 600;
  font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 5px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-buttons {
  display: flex;
  gap: 15px;
  margin-top: 30px;
  justify-content: flex-end;
}

.help-text {
  font-size: 12px;
  color: #999;
  margin-top: 5px;
}

.current-icon {
  font-size: 13px;
  color: #555;
  margin-top: 6px;
  background: #f5f5f5;
  padding: 6px 10px;
  border-radius: 4px;
  display: inline-block;
}

/* --- Message Feedback --- */
.message {
  padding: 12px;
  border-radius: 5px;
  margin-bottom: 20px;
  display: none;
}

.message.success {
  background: #d5f4e6;
  color: #27ae60;
  border-left: 4px solid #27ae60;
}

.message.error {
  background: #fadbd8;
  color: #e74c3c;
  border-left: 4px solid #e74c3c;
}

.message.show {
  display: block;
}

/* --- Loading / Error States --- */
.loading {
  text-align: center;
  padding: 40px;
  color: #999;
  font-size: 15px;
}

.error-state {
  text-align: center;
  padding: 60px;
  color: #e74c3c;
  font-size: 15px;
}

/* --- Dashboard --- */
.welcome {
  margin-bottom: 40px;
}

.welcome h2 {
  color: #333;
  font-size: 28px;
  margin-bottom: 10px;
}

.welcome p {
  color: #666;
  font-size: 16px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.stat-card {
  background: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.12);
}

.stat-card h3 {
  color: #999;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-number {
  font-size: 48px;
  font-weight: bold;
  color: #667eea;
  margin-bottom: 15px;
}

.stat-desc {
  color: #666;
  font-size: 14px;
}

.stat-card.articles .stat-number {
  color: #667eea;
}

.stat-card.categories .stat-number {
  color: #764ba2;
}

/* --- Quill Editor --- */
.editor-label {
  display: block;
  margin-bottom: 8px;
  color: #333;
  font-weight: 600;
  font-size: 14px;
}

#editor {
  height: 300px;
  background: white;
}

.ql-toolbar {
  border: 1px solid #ddd;
  border-radius: 5px 5px 0 0;
  background: #f9f9f9;
}

.ql-container {
  border: 1px solid #ddd;
  border-radius: 0 0 5px 5px;
  border-top: none;
  font-size: 14px;
}

/* --- View Article --- */
.article-card {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.cover-image {
  width: 100%;
  max-height: 350px;
  object-fit: cover;
  display: block;
}

.cover-placeholder {
  width: 100%;
  height: 200px;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 14px;
}

.article-body {
  padding: 30px;
}

.article-meta {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-label {
  font-size: 11px;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.meta-value {
  font-size: 14px;
  color: #333;
  font-weight: 600;
}

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-published {
  background: #d5f4e6;
  color: #27ae60;
}

.status-draft {
  background: #fdebd0;
  color: #e67e22;
}

.divider {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 20px 0;
}

.article-title {
  font-size: 26px;
  color: #333;
  margin-bottom: 12px;
  line-height: 1.3;
}

.article-excerpt {
  font-size: 15px;
  color: #666;
  line-height: 1.6;
  margin-bottom: 20px;
  font-style: italic;
  border-left: 3px solid #667eea;
  padding-left: 15px;
}

.section-label {
  font-size: 13px;
  font-weight: 700;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.content-sections .content-section {
  margin-bottom: 24px;
}

.content-section h3 {
  font-size: 18px;
  color: #333;
  margin-bottom: 8px;
}

.content-section p {
  font-size: 14px;
  color: #555;
  line-height: 1.7;
}

/* --- Pagination --- */
.pagination-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.pagination-info {
  font-size: 13px;
  color: #999;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  padding: 7px 12px;
  border: 1px solid #e0e0e0;
  background: white;
  color: #333;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  min-width: 36px;
}

.page-btn:hover:not(:disabled) {
  background: #e8f4f8;
  border-color: #667eea;
  color: #667eea;
}

.page-btn.active {
  background: #667eea;
  border-color: #667eea;
  color: white;
  font-weight: 600;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-ellipsis {
  padding: 7px 6px;
  color: #999;
  font-size: 13px;
  user-select: none;
}
.login-container {
  background: white;
  width: 100%;
  max-width: 400px;
  padding: 40px;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-header h1 {
  color: #333;
  font-size: 24px;
  margin-bottom: 5px;
}

.login-header p {
  color: #666;
  font-size: 14px;
}

.login-btn {
  width: 100%;
  padding: 12px;
  background: #e8f4f8;
  color: #333;
  border: 1px solid #b3d9e8;
  border-radius: 5px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.login-btn:hover {
  background: #d0ecf4;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.login-btn:active {
  transform: translateY(0);
}

.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.error-message {
  color: #e74c3c;
  font-size: 13px;
  margin-top: 15px;
  padding: 12px;
  background-color: #fadbd8;
  border-radius: 5px;
  border-left: 4px solid #e74c3c;
  display: none;
}

.error-message.show {
  display: block;
}

.success-message {
  color: #27ae60;
  font-size: 13px;
  margin-top: 15px;
  padding: 12px;
  background-color: #d5f4e6;
  border-radius: 5px;
  border-left: 4px solid #27ae60;
  display: none;
}

.success-message.show {
  display: block;
}

.spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid #667eea;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.spinner-wrapper {
  display: none;
  text-align: center;
  margin-top: 15px;
}

.spinner-wrapper.show {
  display: block;
}
