/* General layout */
body {
    font-family: Arial, sans-serif;
    margin: 5px;
    padding: 0;
    width: 99%;
    overflow-x: hidden;
}

/* Card Grid Layout */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0.3rem;
    margin-top: 0.3rem;
}

/* Contact Card Style */
.contact-card {
    max-width: 540px;
    min-width: 300px;
    background: #fff;
    border-radius: 0.8em;
    box-shadow: 0 2px 4px #eaeaea;
    border: 1px solid #e1e1e1;
    margin-bottom: 0.1em;
    display: flex;
    flex-direction: column;
}

/* Header */
.card-header {
    background: #D5E4F3;
    padding: 0.4em 0.4em;
    font-weight: 400;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    border-bottom: 1px solid #eaeaea;
}
.card-print-name {
    font-size: 1.1em;
}
.header-text { flex: 1; }
.small-text { font-size: 0.99em; color: #666; margin-top: 1px; }
.toggle-btn { border: none; background: none; font-size:1.1em; cursor: pointer; }

/* Body */
.card-body {
    padding: 0.2rem 0.5rem;
    font-size: 0.9rem;
    line-height: 1.1;
}
.card-body > div {
    background: #fafdff;
    margin-bottom: 0.2rem;
}
.card-body.collapsed {
    display: none;
}

/* Section grouping */
.card-section {
    break-inside: avoid;
    page-break-inside: avoid;
    -webkit-column-break-inside: avoid;
    margin: 0.25em 0 0.45em 0;
    padding: 0 0 0.15em 0;
    line-height: 0.95;
    border-bottom: 1px solid #f6f6f6;
}

.card-section-title {
    color: #3972b1;
    font-size: 1.1em;
    font-weight: 600;
    margin-top: 0;
    padding-top: 0.4em;
    margin-bottom: 0.15em;
    letter-spacing: 0.03em;
    break-inside: avoid;
}

/* Label-value pair rows */
.card-pair-row {
    display: flex;
    margin-bottom: 0.2em;
    line-height: 1.15;
    border-bottom: 1px solid #f6f6f6;
    padding-bottom: 0.07em;
    break-inside: avoid;
    page-break-inside: avoid;
    -webkit-column-break-inside: avoid;
}

.card-label {
    flex: 0 0 160px;
    color: #444;
    font-weight: 500;
    text-align: right;
    padding-right: 5px;
    white-space: nowrap;
}

.card-value {
    flex: 1;
    text-align: left;
    color: #222;
    word-break: break-word;
}

/* Footer */
.card-footer {
    background: #f6fafd;
    border-top: 1px solid #eaeaea;
    padding: 0.3em 0.3em;
    display: flex;
    justify-content: flex-end;
    gap: 0.4em;
}

/* Toggle Button */
.toggle-btn {
    font-size: 1.0rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: #333;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    border: none;
}

.btn-primary { background-color: #007bff; color: #fff; }
.btn-secondary { background-color: #28a745; color: #fff; }
.btn-danger { background-color: #B6160A; color: #fff; }
.btn-sm { font-size: 0.75rem; padding: 0.2rem 0.4rem; }

/* Search container styling */
.contacts-container form .form-control {
    border-width: 2px;
    padding: 5px;
}

/* Navbar */
nav {
    background-color: #ad0910;
    padding: 5px;
}
nav ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    display: flex;
}
nav ul li a {
    display: block;
    padding: 10px 20px;
    color: white;
    text-decoration: none;
}
nav ul li a:hover {
    background-color: #555;
}

.form-group {
    display: flex;
    align-items: center;  /* Vertical center all label/input pairs */
    margin-bottom: 1px;   /* consistent vertical spacing */
    gap: 8px;             /* horizontal gap between label and input */
}

.form-group label {
    flex: 0 0 125px;       /* fixed width labels */
    margin: 0;
    text-align: right;    /* align label text to right */
    user-select: none;
}

.form-group input,
.form-group select,
.form-group textarea {
    flex: 1;               /* inputs fill remaining width */
    padding: 0px 6px;
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.0;
}

/* Header container */
.header-container {
    text-align: center;
    background-color: #fdedec;
    padding: 10px 1px 1px 1px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* Print styles */
@media print {
    body * {
        visibility: hidden !important;
        font-size: 1.01em !important;
    }
    .contact-card.printing,
    .contact-card.printing * {
        visibility: visible !important;
    }
    .contact-card.printing {
        position: absolute !important;
        left: 0;
        top: 0;
        width: 99vw !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0.3in 0.3in !important; /* minimal padding to avoid edges */
        background: #fff !important;
        border: none !important;
        box-shadow: none !important;
        height: auto !important;
    }
    .card-header {
        margin: 0;
        padding: 0.9em 0.9em;
    }
    .card-print-name {
        font-size: 10.5em;
    }
    .card-footer,
    .toggle-btn {
        display: none !important;
    }
    .card-body {
        column-count: 2 !important;
        column-gap: 0.8em !important;
        column-width: 3in !important;
        font-size: 1.98em;
        padding: 0 !important;
        width: 100% !important;
        max-width: none !important;
    }
    @page {
        size: letter portrait;
        margin: 0;
    }
}

select.form-select.form-control-sm {
  height: calc(1.5em + 0.375rem + 2px); /* Matches input.form-control-sm height */
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  line-height: 1.5;
}
.section-title {
  margin-bottom: 0rem; /* or any smaller value */
  margin-top: 0.6rem;
}
.form-check-input {
  border: 1.5px solid #0d6efd; /* Bootstrap primary color */
  box-shadow: 0 0 5px rgba(13, 110, 253, 0.5); /* subtle blue glow */
  padding: 4px;
  width: 1.4em;
  height: 1.4em;
  border-radius: 0.25rem; /* matches Bootstrap rounded corners */
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-check-input:focus {
  border-color: #0a58ca; /* darker blue on focus */
  box-shadow: 0 0 8px rgba(10, 88, 202, 0.7);
  outline: none;
}