/* admin.css - Dashboard V2 (Sidebar & Dark Mode Polish) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg-dark: #0f172a;        /* Deep background */
  --bg-sidebar: #1e293b;     /* Slightly lighter for sidebar/cards */
  --bg-card: #1e293b;        
  --bg-hover: #334155;       
  --border: #334155;         
  --text-main: #f8fafc;      
  --text-muted: #94a3b8;     
  --accent-cyan: #06b6d4;    
  --accent-cyan-hover: #0891b2;
  --accent-green: #10b981;   
  --accent-red: #ef4444;     
  --accent-yellow: #f59e0b;  
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.2);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.3);
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  opacity: 0; visibility: hidden; transition: opacity 0.3s ease;
}
body.auth-checked { opacity: 1; visibility: visible; }

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-main);
}
.sidebar-header .icon-brand { color: var(--accent-cyan); }

.sidebar-nav {
  flex: 1;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s;
  font-weight: 500;
}

.sidebar-nav a i { width: 20px; height: 20px; }
.sidebar-nav a:hover, .sidebar-nav a.active {
  background-color: rgba(6, 182, 212, 0.1);
  color: var(--accent-cyan);
}
.sidebar-nav a.active {
  border-left: 3px solid var(--accent-cyan);
  border-radius: 0 8px 8px 0;
}

.sidebar-footer {
  padding: 24px 16px;
  border-top: 1px solid var(--border);
}

/* Main Content Area */
.main-content {
  margin-left: 260px;
  flex: 1;
  padding: 32px 48px;
  display: flex;
  flex-direction: column;
  min-width: 0; /* To prevent flex blowouts with wide tables */
}

/* Topbar Mobile (hidden on desktop) */
.mobile-topbar {
  display: none;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  align-items: center;
  justify-content: space-between;
}
.mobile-topbar h1 { font-size: 1.2rem; margin: 0; display:flex; gap:8px; align-items:center;}

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 10px 0 20px rgba(0,0,0,0.5); }
  .main-content { margin-left: 0; padding: 24px;}
  .mobile-topbar { display: flex; }
}

/* Page Header & Actions */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}
.page-title { font-size: 1.8rem; font-weight: 600; display:flex; align-items:center; gap:12px;}

/* Buttons */
.btn-cyan {
  background-color: var(--accent-cyan);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-cyan:hover { background-color: var(--accent-cyan-hover); box-shadow: 0 0 10px rgba(6, 182, 212, 0.5); }
.btn-danger {
  background-color: transparent; border: 1px solid var(--accent-red); color: var(--accent-red);
  padding: 8px 16px; border-radius: 6px; cursor: pointer; transition: 0.2s; display:inline-flex; align-items:center; gap:8px;
}
.btn-danger:hover { background-color: var(--accent-red); color: white; }
.btn-icon { background:transparent; border:none; color:var(--text-muted); cursor:pointer; padding:4px; transition:0.2s; border-radius:4px;}
.btn-icon:hover { color:var(--text-main); background:var(--bg-hover);}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}
.metric-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 24px;
  display: flex; flex-direction: column; gap: 12px;
}
.metric-label { font-size: 0.9rem; color: var(--text-muted); font-weight: 500; display:flex; justify-content:space-between; align-items:center;}
.metric-value { font-size: 2rem; font-weight: 700; color: var(--text-main); }
.text-cyan { color: var(--accent-cyan); }
.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }

/* Tables */
.table-container {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 24px; overflow-x: auto;
}
.table-header { font-size: 1.1rem; font-weight: 600; margin-bottom: 20px; display:flex; justify-content:space-between; flex-wrap:wrap; gap:16px;}
table { width: 100%; border-collapse: collapse; min-width: 800px; text-align: left; }
th { color: var(--text-muted); font-weight: 500; padding: 12px 16px; border-bottom: 1px solid var(--border); }
td { padding: 16px; border-bottom: 1px solid var(--border); color: var(--text-main); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background-color: rgba(255,255,255,0.02); }

/* Badges */
.badge { padding: 4px 10px; border-radius: 100px; font-size: 0.8rem; font-weight: 600; }
.badge-pending { background: rgba(245, 158, 11, 0.1); color: var(--accent-yellow); }
.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--accent-green); }
.badge-new { background: rgba(6, 182, 212, 0.1); color: var(--accent-cyan); }
.badge-neutral { background: rgba(148, 163, 184, 0.1); color: var(--text-muted); }

/* Forms */
.form-control-admin, .search-input {
  background: var(--bg-dark); border: 1px solid var(--border); color: var(--text-main);
  padding: 10px 14px; border-radius: 6px; font-family: inherit; font-size: 0.95rem; width: 100%;
}
.form-control-admin:focus, .search-input:focus { outline: none; border-color: var(--accent-cyan); }

/* Modals */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; justify-content: center; align-items: center;
  z-index: 1000; opacity: 0; pointer-events: none; transition: 0.3s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal-content {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  width: 90%; max-width: 600px; max-height: 90vh; display: flex; flex-direction: column;
}
.modal-header { padding: 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center;}
.modal-body { padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 24px; }
.form-group { display: flex; flex-direction: column; gap: 8px; margin-bottom:16px;}
.form-group label { font-size: 0.9rem; color: var(--text-muted); font-weight: 500; }

/* Detailed OS Modal Styles */
.modal-large { max-width: 900px !important; }
.os-details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.info-section { background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.info-section h3 { font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 8px;}

.client-basic-info { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.client-name { font-size: 1.1rem; font-weight: 600; color: #fff; }
.client-contact { font-size: 0.9rem; color: var(--text-muted); }

.action-buttons { display: flex; gap: 12px; margin-top: 12px; }
.btn-whatsapp { background-color: #25d366 !important; color: white !important; }
.btn-email-blue { background-color: #3b82f6 !important; color: white !important; }

.tag-container { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tag-item { 
    background: rgba(6, 182, 212, 0.1); border: 1px solid rgba(6, 182, 212, 0.3); color: var(--accent-cyan);
    padding: 6px 14px; border-radius: 8px; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: 0.2s;
}
.tag-item:hover, .tag-item.active { background: var(--accent-cyan); color: white; border-color: var(--accent-cyan); }

.intervention-textarea { min-height: 120px; resize: vertical; margin-top: 12px; background: rgba(0,0,0,0.2) !important;}

.modal-footer-actions {
  padding: 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 12px;
}

/* Notification Toast */
.notification-toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    background: var(--bg-sidebar); border: 1px solid var(--accent-green); border-radius: 8px;
    padding: 12px 24px; z-index: 2000; box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    display: flex; align-items: center; gap: 12px; opacity: 0; transition: 0.5s; pointer-events: none;
}
.notification-toast.active { opacity: 1; top: 40px; }
.toast-success { color: var(--accent-green); }

/* Animation for the badge in table */
.ticket-id { font-family: 'Courier New', Courier, monospace; letter-spacing: 0.5px; }
