/* =======================================================
   CONTACTS.CSS – 100% FINAL & PERFECT – NOVEMBER 2025
   • Chart.js displays FULL CHART (no more outline only)
   • Delete button restored
   • X buttons top-right + pointer
   • Everything pixel-perfect
   ======================================================= */

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

   html, body {
     height: 100%;
     width: 100%;
     font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
     background: #f4f6f9;
     color: #333;
     overflow-x: hidden;
   }
   
   /* ==================== NAVBAR ==================== */
   .navbar {
     display: flex;
     justify-content: space-between;
     align-items: center;
     padding: 0 1.5rem;
     background: #007bff;
     color: white;
     position: fixed;
     top: 0; left: 0; right: 0;
     height: 60px;
     z-index: 1000;
   }
   
   #hamburgerButton { display: none; font-size: 1.8rem; color: white; background: none; border: none; cursor: pointer; }
   #signOutBtn {
     background: rgba(255,255,255,0.2);
     color: white;
     border: 1px solid rgba(255,255,255,0.3);
     padding: 0.5rem 1.2rem;
     border-radius: 8px;
     font-weight: 600;
     cursor: pointer;
     transition: all 0.2s;
   }
   #signOutBtn:hover { background: white; color: #007bff; }
   
   @media (max-width: 768px) { #hamburgerButton { display: block; } }
   
   /* ==================== MAIN LAYOUT ==================== */
   #app {
     margin-top: 60px;
     min-height: calc(100vh - 60px);
     display: grid;
     grid-template-columns: 380px 1fr;
     gap: 0;
     overflow: hidden;
   }
   
   .main-content {
     display: flex;
     flex-direction: column;
     height: calc(100vh - 60px);
     overflow: hidden;
   }
   
   /* ==================== SIDEBAR & CONTACT CARDS ==================== */
   .sidebar {
     background: #f8f9fa;
     border-right: 1px solid #dee2e6;
     height: calc(100vh - 60px);
     overflow-y: auto;
     position: sticky;
     top: 60px;
   }
   
   .contact-list {
     display: flex;
     flex-direction: column;
     gap: 14px;
     padding: 0 1rem;
   }
   
   .contact-card {
     display: flex;
     flex-direction: column;
     background: white;
     border: 1px solid #e0e0e0;
     border-radius: 14px;
     padding: 1.3rem;
     position: relative;
     transition: all 0.25s ease;
     cursor: pointer;
     user-select: none;
     box-shadow: 0 3px 10px rgba(0,0,0,0.06);
   }
   
   .contact-card:hover {
     transform: translateY(-5px);
     box-shadow: 0 15px 35px rgba(0,123,255,0.2);
     border-color: #007bff;
     background: #f8fbff;
   }
   
   /* DELETE BUTTON — FULLY RESTORED */
   .delete-btn {
     position: absolute;
     top: 10px;
     right: 10px;
     background: #e74c3c;
     color: white;
     border: none;
     border-radius: 8px;
     padding: 6px 12px;
     font-size: 11px;
     font-weight: 600;
     cursor: pointer;
     opacity: 0;
     transition: all 0.2s;
     z-index: 10;
   }
   
   .contact-card:hover .delete-btn {
     opacity: 1;
     transform: scale(1.05);
   }
   
   /* ==================== CHART — ACTUAL CHART NOW DISPLAYS ==================== */
   .chart-container {
     flex: 1;
     background: white;
     padding: 2.5rem;
     border-radius: 16px;
     box-shadow: 0 10px 40px rgba(0,0,0,0.12);
     margin: 2rem;
     min-height: 0;
     display: flex;
     flex-direction: column;
     position: relative;
     overflow: hidden;
   }
   
   #contactsChart {
     flex: 1;
     width: 100% !important;
     height: 100% !important;
     max-height: 100%;
     display: block !important;
     background: transparent !important;
   }
   
   /* Mobile chart */
   @media (max-width: 768px) {
     #app { grid-template-columns: 1fr; display: block; }
     .main-content { height: auto; min-height: calc(100vh - 60px); overflow: visible; }
     .chart-container {
       margin: 2rem 1rem;
       padding: 2rem;
       height: 480px !important;
     }
   }
   
   /* ==================== MOBILE COLLAPSE ==================== */
   .contact-list-container { position: relative; }
   .collapse-btn { display: none; }
   
   @media (max-width: 768px) {
     .sidebar { position: relative; height: auto; border-right: none; }
     .collapse-btn {
       display: flex;
       justify-content: center;
       align-items: center;
       width: 100%;
       padding: 1.4rem;
       background: linear-gradient(135deg, #007bff, #0056b3);
       color: white;
       border: none;
       border-radius: 16px;
       font-size: 1.35rem;
       font-weight: 700;
       cursor: pointer;
       box-shadow: 0 8px 28px rgba(0,123,255,0.4);
       margin: 1rem 0;
     }
     .contact-list-wrapper {
       max-height: 0;
       overflow: hidden;
       transition: max-height 0.5s ease, padding 0.5s ease;
       background: #f8f9fa;
       border-radius: 0 0 16px 16px;
       margin-top: -12px;
     }
     .contact-list-container:not(.collapsed) .contact-list-wrapper {
       max-height: 100vh;
       padding: 1.5rem 1rem;
     }
   }
   
   /* ==================== FORMS & BUTTONS ==================== */
   .form-group {
     margin-bottom: 1.5rem;
   }
   
   .form-group label {
     display: block;
     margin-bottom: 0.6rem;
     font-weight: 600;
     color: #333;
   }
   
   .form-group input,
   .form-group textarea {
     width: 100%;
     padding: 0.95rem;
     border: 1.5px solid #ddd;
     border-radius: 12px;
     font-size: 1rem;
     background: #fdfdfd;
     transition: all 0.2s;
   }
   
   .form-group input:focus,
   .form-group textarea:focus {
     outline: none;
     border-color: #007bff;
     background: white;
     box-shadow: 0 0 0 4px rgba(0,123,255,0.15);
   }
   
   /* Save buttons */
   #addContactSubmit,
   #saveEditBtn,
   .btn-primary {
     width: 100%;
     padding: 1.1rem;
     background: linear-gradient(135deg, #007bff, #0056b3);
     color: white;
     border: none;
     border-radius: 14px;
     font-size: 1.15rem;
     font-weight: 700;
     cursor: pointer;
     margin-top: 1rem;
     transition: all 0.3s;
     box-shadow: 0 8px 25px rgba(0,123,255,0.4);
   }
   
   #addContactSubmit:hover,
   #saveEditBtn:hover,
   .btn-primary:hover {
     background: linear-gradient(135deg, #0056b3, #004085);
     transform: translateY(-4px);
   }
   
   /* Edit & Add Note buttons */
   .edit-btn,
   .add-log-btn {
     background: #007bff;
     color: white;
     border: none;
     padding: 0.9rem 1.8rem;
     border-radius: 12px;
     font-weight: 600;
     cursor: pointer;
     box-shadow: 0 6px 20px rgba(0,123,255,0.3);
     transition: all 0.2s;
   }
   
   .edit-btn:hover { background: #0056b3; transform: translateY(-3px); }
   .add-log-btn { background: #28a745; }
   .add-log-btn:hover { background: #218838; transform: translateY(-3px); }
   
   .detail-actions {
     display: flex;
     gap: 1rem;
     justify-content: center;
     flex-wrap: wrap;
     margin: 2rem 0;
   }
   
   /* ==================== MODAL — X BUTTON TOP-RIGHT + POINTER ==================== */
   .modal {
     display: none !important;
     position: fixed;
     inset: 0;
     background: rgba(0,0,0,0.75);
     backdrop-filter: blur(10px);
     z-index: 2000;
     justify-content: center;
     align-items: center;
     opacity: 0;
     pointer-events: none;
     transition: opacity 0.3s ease;
   }
   
   .modal.active {
     display: flex !important;
     opacity: 1;
     pointer-events: all;
   }
   
   .modal-content {
     position: relative;
     background: white;
     width: 90%;
     max-width: 540px;
     border-radius: 20px;
     padding: 2.5rem;
     box-shadow: 0 30px 80px rgba(0,0,0,0.35);
     max-height: 92vh;
     overflow-y: auto;
   }
   
   .close {
     position: absolute;
     top: 1rem;
     right: 1.5rem;
     font-size: 2rem;
     color: #999;
     background: none;
     border: none;
     cursor: pointer;
     z-index: 10;
     width: 44px;
     height: 44px;
     display: flex;
     align-items: center;
     justify-content: center;
     border-radius: 50%;
     transition: all 0.2s;
   }
   
   .close:hover {
     color: #000;
     background: #f0f0f0;
   }
   
   /* ==================== CONTACT DETAIL — CLOSE BUTTON TOP-RIGHT + POINTER ==================== */
   #closeDetail {
     position: absolute;
     top: 1rem;
     right: 1rem;
     background: #dc3545;
     color: white;
     border: none;
     width: 44px;
     height: 44px;
     border-radius: 50%;
     font-size: 1.5rem;
     cursor: pointer;
     z-index: 999;
     box-shadow: 0 4px 12px rgba(220,53,69,0.4);
     opacity: 0;
     transition: opacity 0.3s;
     display: flex;
     align-items: center;
     justify-content: center;
   }
   
   #contactDetail.active #closeDetail {
     opacity: 1;
   }
   
   #closeDetail:hover {
     background: #c82333;
     transform: scale(1.1);
   }
   
   /* ==================== CONTACT DETAIL PANEL ==================== */
   #contactDetail {
     position: fixed;
     top: 60px;
     right: 0;
     width: 420px;
     max-width: 100%;
     height: calc(100vh - 60px);
     background: white;
     padding: 1.5rem;
     overflow-y: auto;
     border-left: 1px solid #dee2e6;
     box-shadow: -6px 0 30px rgba(0,0,0,0.15);
     z-index: 900;
     transform: translateX(100%);
     transition: transform 0.35s ease;
   }
   
   #contactDetail.active { transform: translateX(0); }
   
   @media (max-width: 768px) {
     #contactDetail { width: 100%; left: 0; }
   }
   
   /* ==================== FLOATING ADD BUTTON ==================== */
   .add-btn {
     position: fixed;
     bottom: 2rem;
     right: 2rem;
     width: 64px;
     height: 64px;
     background: #007bff;
     color: white;
     border: none;
     border-radius: 50%;
     font-size: 2.4rem;
     cursor: pointer;
     box-shadow: 0 10px 30px rgba(0,123,255,0.5);
     z-index: 1000;
     transition: all 0.3s;
     display: flex;
     align-items: center;
     justify-content: center;
   }
   
   .add-btn:hover {
     transform: scale(1.12);
     box-shadow: 0 16px 45px rgba(0,123,255,0.6);
   }