/* dashboard.css - Professional, responsive, clean */

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

body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: #f4f7fc;
    color: #1e2a3a;
    line-height: 1.5;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

/* Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 28px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    margin-bottom: 2rem;
}

.logo-area .logo {
    font-size: 2rem;
    font-weight: 800;
    color: #1e2a3a;
}
.logo span {
    color: #f39c12;
}
.tagline {
    font-size: 0.9rem;
    color: #5a6e7c;
    margin-top: 0.25rem;
}

.phone-area {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}
#phoneInput {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 40px;
    width: 220px;
    outline: none;
}
.btn-primary, .btn-secondary, .btn-pdf {
    padding: 0.75rem 1.5rem;
    border-radius: 40px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}
.btn-primary {
    background: #f39c12;
    color: #1e2a3a;
}
.btn-primary:hover {
    background: #e67e22;
    transform: translateY(-2px);
}
.btn-secondary {
    background: #e2e8f0;
    color: #1e2a3a;
}
.btn-secondary:hover {
    background: #cbd5e1;
}
.btn-pdf {
    background: #2c3e50;
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}
.btn-pdf:hover {
    background: #1a252f;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.summary-card {
    text-align: center;
}
.big-number {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0.5rem 0;
    color: #f39c12;
}

/* Charts */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.chart-card {
    padding: 1.5rem;
}
canvas {
    max-height: 250px;
    width: 100%;
}

/* Reminders */
.reminders-section .card {
    padding: 1.5rem;
}
.reminder-item {
    background: #fef9e6;
    border-left: 4px solid #e67e22;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    border-radius: 12px;
}
.reminder-item strong {
    color: #c0392b;
}

/* History Table */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.table-wrapper {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
th, td {
    border: 1px solid #e2e8f0;
    padding: 0.75rem;
    text-align: left;
    vertical-align: top;
}
th {
    background: #1e2a3a;
    color: white;
}
tr:nth-child(even) {
    background: #f8fafc;
}
.pdf-row-btn {
    background: #3498db;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    color: white;
    cursor: pointer;
    font-size: 0.75rem;
}
.pdf-row-btn:hover {
    background: #2980b9;
}

/* Card styling */
.card {
    background: white;
    border-radius: 24px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s;
}
.card:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}
.text-muted {
    color: #6c7a89;
}

/* Footer */
.dashboard-footer {
    text-align: center;
    margin-top: 2rem;
    padding: 1rem;
    font-size: 0.8rem;
    color: #6c7a89;
}

/* Loading spinner */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #f39c12;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 10px;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===================================================== */
/* MODAL STYLES (for document preview)                  */
/* ===================================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.8);
}
.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border: 1px solid #888;
    width: 80%;
    max-width: 800px;
    border-radius: 8px;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    max-height: 90%;
}
.modal-header {
    padding: 15px;
    background-color: #2c3e50;
    color: white;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 {
    margin: 0;
}
.close-modal-btn {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.close-modal-btn:hover {
    color: white;
}
.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
    text-align: center;
}
.modal-body img {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
}
.modal-footer {
    padding: 15px;
    text-align: right;
    border-top: 1px solid #e2e8f0;
}

/* Responsive modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

/* Responsive (existing) */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    .charts-row {
        grid-template-columns: 1fr;
    }
    .summary-cards {
        grid-template-columns: 1fr;
    }
}


/* =====================================================
   GLOBAL MODAL (replaces alert/confirm)
   ===================================================== */
.g-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
}

.g-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
}

.g-modal-container {
    position: relative;
    background: white;
    max-width: 480px;
    width: 90%;
    border-radius: 28px;
    box-shadow: 0 30px 40px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.2s ease-out;
    z-index: 10001;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: scale(0.96) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.g-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1.5rem 1.5rem 0.5rem 1.5rem;
}

.g-modal-icon {
    font-size: 1.8rem;
}

.g-modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    flex: 1;
    color: #1a2a3a;
}

.g-modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #888;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: background 0.2s;
}

.g-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.g-modal-body {
    padding: 0.5rem 1.5rem 1rem 1.5rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #1e293b;
}

.g-modal-footer {
    padding: 0.5rem 1.5rem 1.5rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.g-modal-btn {
    padding: 10px 20px;
    border-radius: 40px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.g-modal-btn-primary {
    background: #f39c12;
    color: #1e2a3a;
}

.g-modal-btn-primary:hover {
    background: #e67e22;
    transform: translateY(-1px);
}

.g-modal-btn-secondary {
    background: #e2e8f0;
    color: #1e293b;
}

.g-modal-btn-secondary:hover {
    background: #cbd5e1;
}

/* PWA Install Banner */
#pwa-install-banner {
  position: sticky;
  top: 0;
  z-index: 10000;
  background: linear-gradient(135deg, #f39c12, #e67e22);
  color: #0f172a;
  padding: 0.6rem 1.2rem;
  font-family: system-ui, sans-serif;
  font-size: 0.95rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  animation: slideDown 0.3s ease-out;
}
@keyframes slideDown {
  from { transform: translateY(-100%); }
  to   { transform: translateY(0); }
}
.pwa-banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.pwa-banner-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.pwa-install-btn {
  background: #0f172a;
  color: white;
  border: none;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.pwa-install-btn:hover { background: #1e293b; }
.pwa-dismiss-btn {
  background: none;
  border: none;
  color: #0f172a;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}