/*
Theme Name: Finance Manager Pro
Theme URI: https://example.com/finance-manager-pro
Author: Custom Development
Author URI: https://example.com
Description: Complete Finance & Accounting WordPress Theme - Daily expenses, Client ledger, Employee advances, Cash records with beautiful modern UI. Fully responsive and high quality.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: finance-manager
Tags: finance, accounting, business, responsive, custom-post-type, dashboard
*/

/* =====================================================
   CSS VARIABLES - Modern Finance Color System
   ===================================================== */
:root {
  --primary: #0f766e;
  --primary-dark: #0d5c56;
  --primary-light: #14b8a6;
  --secondary: #1e293b;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  
  --bg-body: #f1f5f9;
  --bg-card: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;
  
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-light: #f8fafc;
  
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  
  --sidebar-width: 280px;
  --header-height: 70px;
  
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* =====================================================
   RESET & BASE
   ===================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* =====================================================
   LAYOUT - Sidebar + Main
   ===================================================== */
.fm-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.fm-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--text-light);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-xl);
}

.fm-sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.fm-logo {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: white;
  box-shadow: 0 4px 12px rgba(20, 184, 166, 0.4);
}

.fm-logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.fm-logo-text span {
  color: var(--primary-light);
}

.fm-nav {
  flex: 1;
  padding: 20px 12px;
  overflow-y: auto;
}

.fm-nav-section {
  margin-bottom: 28px;
}

.fm-nav-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 0 12px 10px;
}

.fm-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: #94a3b8;
  font-weight: 500;
  font-size: 14.5px;
  margin-bottom: 4px;
  transition: all 0.2s ease;
}

.fm-nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: white;
}

.fm-nav-item.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.4);
}

.fm-nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.fm-sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: var(--text-muted);
}

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

.fm-header {
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

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

.fm-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text-primary);
}

.fm-page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text-primary);
}

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

.fm-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  background: var(--bg-body);
  border-radius: 50px;
  font-size: 14px;
  font-weight: 500;
}

.fm-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 14px;
}

.fm-content {
  flex: 1;
  padding: 28px 32px;
}

/* =====================================================
   CARDS & STATS
   ===================================================== */
.fm-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.fm-stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fm-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.fm-stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.fm-stat-card.income::before { background: var(--success); }
.fm-stat-card.expense::before { background: var(--danger); }
.fm-stat-card.balance::before { background: var(--primary); }
.fm-stat-card.pending::before { background: var(--warning); }

.fm-stat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.fm-stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.fm-stat-change {
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.fm-stat-change.up { color: var(--success); }
.fm-stat-change.down { color: var(--danger); }

.fm-stat-icon {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.15;
}

.fm-stat-card.income .fm-stat-icon { background: var(--success); color: var(--success); }
.fm-stat-card.expense .fm-stat-icon { background: var(--danger); color: var(--danger); }
.fm-stat-card.balance .fm-stat-icon { background: var(--primary); color: var(--primary); }
.fm-stat-card.pending .fm-stat-icon { background: var(--warning); color: var(--warning); }

/* =====================================================
   CARDS & TABLES
   ===================================================== */
.fm-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 24px;
}

.fm-card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.fm-card-title {
  font-size: 17px;
  font-weight: 650;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.fm-card-body {
  padding: 0;
}

.fm-table-wrap {
  overflow-x: auto;
}

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

.fm-table th {
  background: var(--bg-body);
  padding: 14px 20px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.fm-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.fm-table tr:last-child td {
  border-bottom: none;
}

.fm-table tr:hover td {
  background: #f8fafc;
}

/* =====================================================
   BADGES & STATUS
   ===================================================== */
.fm-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.fm-badge.success {
  background: #d1fae5;
  color: #065f46;
}

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

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

.fm-badge.info {
  background: #dbeafe;
  color: #1e40af;
}

.fm-badge.neutral {
  background: #f1f5f9;
  color: #475569;
}

/* =====================================================
   BUTTONS
   ===================================================== */
.fm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.fm-btn-primary {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: white;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.3);
}

.fm-btn-primary:hover {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.4);
}

.fm-btn-secondary {
  background: var(--bg-body);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

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

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

.fm-btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.fm-btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 8px;
}

/* =====================================================
   FORMS
   ===================================================== */
.fm-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding: 24px;
}

.fm-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fm-form-group.full {
  grid-column: 1 / -1;
}

.fm-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.fm-input,
.fm-select,
.fm-textarea {
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--text-primary);
  transition: all 0.2s ease;
  outline: none;
}

.fm-input:focus,
.fm-select:focus,
.fm-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.fm-textarea {
  min-height: 100px;
  resize: vertical;
}

/* =====================================================
   AMOUNT DISPLAY
   ===================================================== */
.fm-amount {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14.5px;
}

.fm-amount.positive { color: var(--success); }
.fm-amount.negative { color: var(--danger); }
.fm-amount.neutral { color: var(--text-primary); }

/* =====================================================
   EMPTY STATE
   ===================================================== */
.fm-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.fm-empty svg {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  opacity: 0.4;
}

.fm-empty h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1200px) {
  .fm-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 992px) {
  .fm-sidebar {
    transform: translateX(-100%);
  }
  
  .fm-sidebar.open {
    transform: translateX(0);
  }
  
  .fm-main {
    margin-left: 0;
  }
  
  .fm-menu-toggle {
    display: flex;
  }
  
  .fm-content {
    padding: 20px 16px;
  }
  
  .fm-header {
    padding: 0 16px;
  }
  
  .fm-form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .fm-stats-grid {
    grid-template-columns: 1fr;
  }
  
  .fm-page-title {
    font-size: 18px;
  }
  
  .fm-stat-value {
    font-size: 24px;
  }
  
  .fm-card-header {
    padding: 16px;
  }
  
  .fm-table th,
  .fm-table td {
    padding: 12px 14px;
  }
}

/* Overlay for mobile sidebar */
.fm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}

.fm-overlay.show {
  display: block;
}

/* =====================================================
   UTILITY
   ===================================================== */
.fm-flex {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fm-gap-2 { gap: 8px; }
.fm-gap-3 { gap: 12px; }
.fm-gap-4 { gap: 16px; }

.fm-mt-2 { margin-top: 8px; }
.fm-mt-3 { margin-top: 12px; }
.fm-mt-4 { margin-top: 16px; }
.fm-mb-3 { margin-bottom: 12px; }
.fm-mb-4 { margin-bottom: 16px; }

.text-right { text-align: right; }
.text-center { text-align: center; }
.font-mono { font-family: var(--font-mono); }

/* Scrollbar */
.fm-sidebar::-webkit-scrollbar,
.fm-table-wrap::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.fm-sidebar::-webkit-scrollbar-track,
.fm-table-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.fm-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
}

.fm-table-wrap::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}
/* =====================================================
   ALERTS
   ===================================================== */
.fm-alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-weight: 500;
  font-size: 14.5px;
}
.fm-alert-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.fm-alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
