/* Style Design System for Tra cứu Địa chỉ P Nam Định */

:root {
    --primary-red: #a90000;
    --primary-red-light: #ffeb3b;
    --red-gradient: linear-gradient(135deg, #8b0000 0%, #d32f2f 100%);
    --police-blue: #0b5394;
    --police-blue-dark: #073763;
    --blue-gradient: linear-gradient(180deg, #0f5693 0%, #093c68 100%);
    
    --cskv-color: #c62828;
    --hs-color: #2e7d32;
    --disabled-grey: #b0bec5;
    
    --bg-light: #f5f7fb;
    --card-bg: #ffffff;
    --text-main: #212121;
    --text-muted: #616161;
    --border-color: #e0e0e0;
    
    --btn-call-bg: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%);
    --btn-copy-bg: #ffffff;
    --btn-copy-border: #cfd8dc;
    --btn-copy-text: #37474f;
    
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
}

/* Reset and Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-light);
    color: var(--text-main);
    line-height: 1.5;
    padding-top: 60px; /* Header space */
    padding-bottom: 85px; /* Search bar space */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header styling */
.police-header {
    background: var(--red-gradient);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border-bottom: 2px solid var(--primary-red-light);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.emblem-icon {
    font-size: 28px;
    color: var(--primary-red-light);
    text-shadow: 0 0 10px rgba(255, 235, 59, 0.6);
}

.police-header h1 {
    font-family: var(--font-heading);
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
}

/* Main Layout Container */
.content-container {
    flex: 1;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Warning Banner */
.notice-banner {
    background-color: #fff5f5;
    border: 1px solid #ffccd2;
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.4s ease-out;
}

.notice-icon {
    color: var(--primary-red);
    font-size: 22px;
    margin-top: 2px;
}

.notice-text {
    font-size: 13.5px;
    color: #5c0000;
    line-height: 1.45;
}

.notice-text strong {
    font-weight: 700;
}

.notice-link {
    color: var(--primary-red);
    text-decoration: none;
    font-weight: 700;
    border-bottom: 1.5px dashed var(--primary-red);
}

/* Cards Grid */
.cards-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Address Card Styling */
.address-card {
    background-color: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: slideUp 0.35s ease-out;
}

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

/* Card Header */
.card-header {
    background: var(--blue-gradient);
    color: white;
    padding: 16px 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
}

.card-title-row {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.card-title {
    font-family: var(--font-heading);
    font-size: 19px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: 0.2px;
    padding: 0 45px; /* Prevent text overlap with absolute badge */
    width: 100%;
}

.tdp-badge {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: 1.5px solid white;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
    text-transform: uppercase;
}

.card-subtitle {
    font-size: 13.5px;
    opacity: 0.9;
    font-weight: 500;
}

.card-subtitle-2 {
    font-size: 12px;
    opacity: 0.8;
}

/* Card Body - Columns Split */
.card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 16px 0;
}

.card-col {
    padding: 8px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
}

.card-col:first-child {
    border-right: 1px solid var(--border-color);
}

.col-role {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.col-name {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 2px;
    min-height: 40px; /* Aligns phone numbers if names wrap */
    display: flex;
    align-items: center;
    justify-content: center;
}

.cskv-col .col-name {
    color: var(--cskv-color);
}

.hs-col .col-name {
    color: var(--hs-color);
}

.col-phone {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.2px;
    margin-bottom: 10px;
}

/* Buttons inside Card */
.col-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 140px;
}

.btn-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 12px;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
    border: none;
    outline: none;
    width: 100%;
}

.btn-card .material-symbols-outlined {
    font-size: 16px;
}

.btn-card:active {
    transform: scale(0.97);
}

/* Call Button CSS */
.btn-call {
    background: var(--btn-call-bg);
    color: white;
    box-shadow: 0 2px 4px rgba(46, 125, 50, 0.2);
}

.btn-call:hover {
    filter: brightness(1.1);
}

/* Copy Button CSS */
.btn-copy {
    background: var(--btn-copy-bg);
    border: 1px solid var(--btn-copy-border);
    color: var(--btn-copy-text);
}

.btn-copy:hover {
    background-color: #f5f7f8;
    border-color: #b0bec5;
}

/* Disabled Officer State */
.card-col.disabled {
    opacity: 0.55;
}

.card-col.disabled .col-name {
    color: var(--text-muted);
}

.card-col.disabled .btn-card {
    background: #e0e0e0;
    border: 1px solid #e0e0e0;
    color: #9e9e9e;
    cursor: not-allowed;
    box-shadow: none;
    pointer-events: none; /* Block click/tap events */
}

/* Bottom Search Bar Styles */
.search-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 75px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    z-index: 1000;
}

.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    display: flex;
    align-items: center;
}

.search-wrapper .search-icon {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 24px;
    pointer-events: none;
}

.search-wrapper input {
    width: 100%;
    height: 48px;
    background: #ffffff;
    border: 1px solid #cfd8dc;
    border-radius: 24px;
    padding-left: 50px;
    padding-right: 90px; /* Space for clear button and count */
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--text-main);
    outline: none;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-wrapper input:focus {
    border-color: var(--police-blue);
    box-shadow: 0 0 0 3px rgba(11, 83, 148, 0.15), var(--shadow-sm);
}

.clear-btn {
    position: absolute;
    right: 54px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 50%;
    transition: background-color 0.15s ease;
}

.clear-btn:hover {
    background-color: #eceff1;
}

.clear-btn .material-symbols-outlined {
    font-size: 20px;
}

.search-count {
    position: absolute;
    right: 16px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    background: #eceff1;
    padding: 3px 8px;
    border-radius: 12px;
    pointer-events: none;
}

/* Spinner Loaders */
.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 12px;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(11, 83, 148, 0.15);
    border-top: 4px solid var(--police-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner.small {
    width: 24px;
    height: 24px;
    border-width: 3px;
}

.sentinel {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sentinel.loading {
    opacity: 1;
}

/* Empty search state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
    animation: fadeIn 0.3s ease-out;
}

.empty-icon {
    font-size: 64px;
    color: var(--disabled-grey);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    color: var(--text-main);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 14px;
    max-width: 300px;
}

/* Toast Success Copied capsule */
.toast-container {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background-color: rgba(33, 33, 33, 0.9);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: toastIn 0.25s ease-out forwards;
    backdrop-filter: blur(4px);
}

.toast-success-icon {
    color: #4caf50;
    font-size: 18px;
}

.hidden {
    display: none !important;
}

/* Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* Responsive breakpoint adjustments */
@media (min-width: 650px) {
    .cards-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
    
    .notice-banner {
        grid-column: span 2;
    }
    
    .empty-state {
        grid-column: span 2;
    }
}
