/* ============================================================
   Auto Dealer Directory — Main Stylesheet
   ============================================================ */

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary:       #1e3a5f;
    --primary-lt:    #2a4f7c;
    --accent:        #c0392b;
    --accent-hov:    #a93226;
    --bg:            #f4f6f8;
    --white:         #ffffff;
    --text:          #212529;
    --muted:         #6c757d;
    --border:        #dee2e6;
    --success:       #27ae60;
    --error:         #e74c3c;
    --warning:       #e67e22;
    --radius:        6px;
    --shadow:        0 2px 8px rgba(0,0,0,.08);
    --shadow-lg:     0 4px 20px rgba(0,0,0,.13);
    --trans:         .18s ease;
    --max-w:         1200px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--accent); }

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }
main { flex: 1; }

/* ============================================================
   Header
   ============================================================ */
header {
    background: var(--primary);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,.25);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
}

.logo {
    color: #fff;
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 9px;
    letter-spacing: -.3px;
}
.logo:hover { color: #d9ecff; }
.logo-icon  { font-size: 1.45rem; }

header nav a {
    color: #fff;
    font-weight: 600;
    font-size: .9rem;
    padding: 8px 18px;
    border-radius: var(--radius);
    background: var(--accent);
    transition: background var(--trans);
}
header nav a:hover { background: var(--accent-hov); }

/* ============================================================
   Hero
   ============================================================ */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-lt) 100%);
    color: #fff;
    padding: 64px 0;
    text-align: center;
}
.hero h1 {
    font-size: 2.4rem;
    font-weight: 800;
    margin-bottom: 16px;
    line-height: 1.2;
    letter-spacing: -.4px;
}
.hero p { font-size: 1.1rem; opacity: .9; max-width: 620px; margin: 0 auto; }

.cta-link { color: #ffd166; font-weight: 600; text-decoration: underline; }
.cta-link:hover { color: #ffe99a; }

/* ============================================================
   States Grid
   ============================================================ */
.states-section { padding: 50px 0; }
.states-section h2 { font-size: 1.7rem; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.section-sub { color: var(--muted); margin-bottom: 28px; }

.states-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.state-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 18px 10px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: all var(--trans);
    gap: 4px;
}
.state-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    color: var(--primary);
}
.state-card.has-listings { border-color: #b8d8f5; background: #f0f7ff; }
.state-name  { font-weight: 600; font-size: .88rem; line-height: 1.3; }
.state-count { font-size: .74rem; color: var(--muted); }
.state-card.has-listings .state-count { color: var(--accent); font-weight: 500; }

/* ============================================================
   Info Cards
   ============================================================ */
.info-section { padding: 0 0 50px; }

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}

.info-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
}
.info-card h3 { font-size: 1.05rem; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.info-card p  { color: var(--muted); font-size: .93rem; margin-bottom: 16px; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-block;
    padding: 10px 22px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: .93rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--trans);
    line-height: 1.4;
}
.btn:hover        { background: var(--accent-hov); color: #fff; }
.btn-sm           { padding: 6px 13px; font-size: .82rem; }
.btn-success      { background: var(--success); }
.btn-success:hover{ background: #1e8a4a; }
.btn-danger       { background: var(--error); }
.btn-danger:hover { background: #c0392b; }
.btn-outline      { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover{ background: var(--primary); color: #fff; }

/* ============================================================
   Breadcrumb
   ============================================================ */
.breadcrumb {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 11px 0;
    font-size: .85rem;
    color: var(--muted);
}
.breadcrumb a { color: var(--primary); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { margin: 0 6px; }

/* ============================================================
   State Page / Listings
   ============================================================ */
.page-header { padding: 38px 0 18px; }
.page-header h1 { font-size: 2rem; font-weight: 800; color: var(--primary); margin-bottom: 6px; }
.listing-meta { color: var(--muted); font-size: .93rem; }
.listing-meta a { color: var(--accent); font-weight: 600; }

.listings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    padding: 16px 0 40px;
}

.listing-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 7px;
    transition: box-shadow var(--trans);
}
.listing-card:hover { box-shadow: var(--shadow-lg); }

.listing-card h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.3;
    margin: 0;
}

.listing-badge {
    display: inline-block;
    font-size: .73rem;
    color: var(--muted);
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid var(--border);
    width: fit-content;
}

.listing-url {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--accent);
    font-weight: 600;
    font-size: .88rem;
    text-decoration: none;
    margin-top: 4px;
}
.listing-url:hover { color: var(--accent-hov); text-decoration: underline; }

.listing-date {
    font-size: .76rem;
    color: var(--muted);
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

/* ============================================================
   Empty State
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 24px 0;
}
.empty-state p { font-size: 1.05rem; color: var(--muted); margin-bottom: 20px; }

/* ============================================================
   Submit CTA
   ============================================================ */
.submit-cta {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    margin-bottom: 50px;
    box-shadow: var(--shadow);
}
.submit-cta h2 { font-size: 1.45rem; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.submit-cta p  { color: var(--muted); margin-bottom: 20px; }

/* ============================================================
   Form
   ============================================================ */
.form-page { padding: 50px 0; }

.form-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    max-width: 640px;
    margin: 0 auto;
    box-shadow: var(--shadow);
}
.form-card h1         { font-size: 1.7rem; font-weight: 800; color: var(--primary); margin-bottom: 6px; }
.form-card .form-sub  { color: var(--muted); margin-bottom: 28px; font-size: .93rem; }

.form-group         { margin-bottom: 22px; }
.form-group label   { display: block; font-weight: 600; font-size: .88rem; color: var(--text); margin-bottom: 6px; }
.form-group .req    { color: var(--accent); margin-left: 2px; }
.field-hint         { font-size: .78rem; color: var(--muted); margin-top: 5px; display: block; }

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: .93rem;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    transition: border-color var(--trans), box-shadow var(--trans);
    -webkit-appearance: none;
    appearance: none;
}
.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%236c757d' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30,58,95,.1);
}

.honeypot { display: none !important; visibility: hidden; }

.error-box {
    background: #fdf0ef;
    border: 1px solid #f5c6cb;
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 22px;
    color: var(--error);
}
.error-box ul { list-style: none; padding: 0; }
.error-box li::before { content: '\2715  '; font-weight: bold; }

.form-terms  { font-size: .78rem; color: var(--muted); margin-top: 12px; text-align: center; }
.form-submit { width: 100%; padding: 13px; font-size: 1rem; }

/* ============================================================
   Thank You
   ============================================================ */
.thankyou-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 40px 20px;
}
.thankyou-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 50px 40px;
    text-align: center;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow);
}
.thankyou-icon       { font-size: 3.5rem; margin-bottom: 18px; }
.thankyou-card h1    { font-size: 1.8rem; font-weight: 800; color: var(--primary); margin-bottom: 12px; }
.thankyou-card p     { color: var(--muted); margin-bottom: 20px; line-height: 1.7; }

/* ============================================================
   Footer
   ============================================================ */
footer {
    background: #0d1b2a;
    color: rgba(255,255,255,.65);
    padding: 40px 0 22px;
    margin-top: auto;
}
.footer-states      { display: flex; flex-wrap: wrap; gap: 7px 16px; margin-bottom: 28px; }
.footer-states a    { color: rgba(255,255,255,.55); font-size: .78rem; transition: color var(--trans); }
.footer-states a:hover { color: #fff; }
.footer-copy        { font-size: .82rem; opacity: .45; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.1); }

/* ============================================================
   Admin
   ============================================================ */
.admin-header {
    background: #0d1b2a;
    color: #fff;
    padding: 15px 0;
}
.admin-header-inner { display: flex; align-items: center; justify-content: space-between; }
.admin-header h1    { font-size: 1.15rem; font-weight: 700; }
.admin-header a     { color: rgba(255,255,255,.65); font-size: .85rem; transition: color var(--trans); }
.admin-header a:hover { color: #fff; }

.admin-main { padding: 28px 0; }

.admin-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-bottom: 28px; }
.admin-stat  { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-align: center; }
.stat-num    { font-size: 2rem; font-weight: 800; color: var(--primary); line-height: 1; }
.stat-lbl    { font-size: .78rem; color: var(--muted); margin-top: 5px; }

.admin-tabs  { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 22px; gap: 3px; }
.admin-tab   { padding: 9px 20px; font-weight: 600; font-size: .88rem; color: var(--muted); text-decoration: none; border-radius: var(--radius) var(--radius) 0 0; transition: color var(--trans); }
.admin-tab.active {
    color: var(--primary);
    background: var(--white);
    border: 2px solid var(--border);
    border-bottom: 2px solid var(--white);
    margin-bottom: -2px;
}
.admin-tab:hover { color: var(--primary); }

.admin-table { width: 100%; border-collapse: collapse; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.admin-table th { background: var(--primary); color: #fff; font-size: .82rem; font-weight: 600; padding: 11px 14px; text-align: left; white-space: nowrap; }
.admin-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: .88rem; vertical-align: top; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #f8f9fa; }
.url-cell   { max-width: 200px; word-break: break-all; font-size: .78rem; }
.url-cell a { color: var(--primary); text-decoration: underline; }
.actions    { display: flex; gap: 7px; flex-wrap: wrap; }

.admin-empty { text-align: center; padding: 40px; color: var(--muted); background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; background: var(--bg); }
.login-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px; width: 100%; max-width: 360px; box-shadow: var(--shadow-lg); }
.login-card h1  { font-size: 1.45rem; font-weight: 800; color: var(--primary); margin-bottom: 4px; }
.login-sub      { color: var(--muted); font-size: .84rem; margin-bottom: 26px; }
.login-error    { background: #fdf0ef; border: 1px solid #f5c6cb; border-radius: var(--radius); padding: 10px 14px; color: var(--error); font-size: .85rem; margin-bottom: 18px; }

/* ============================================================
   How It Works
   ============================================================ */
.how-it-works      { padding: 0 0 50px; }
.how-it-works h2   { font-size: 1.7rem; font-weight: 700; color: var(--primary); margin-bottom: 28px; }
.steps-grid        { display: grid; grid-template-columns: repeat(3,1fr); gap: 22px; }
.step              { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; text-align: center; box-shadow: var(--shadow); }
.step-num          { width: 48px; height: 48px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 1.3rem; font-weight: 800; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.step h3           { font-size: 1rem; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.step p            { font-size: .88rem; color: var(--muted); line-height: 1.6; }

/* ============================================================
   Listing Card Extras (phone, description)
   ============================================================ */
.listing-phone { font-size: .85rem; color: var(--muted); }
.listing-desc  { font-size: .85rem; color: var(--text); line-height: 1.5; }

/* Optional field label */
.optional { font-weight: 400; font-size: .78rem; color: var(--muted); margin-left: 4px; }

/* ============================================================
   FAQ Page
   ============================================================ */
.faq-page  { padding: 20px 0 50px; }
.faq-list  { max-width: 780px; margin-bottom: 40px; }
.faq-item  { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 10px; box-shadow: var(--shadow); }
.faq-q     { font-size: .98rem; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.faq-a     { color: var(--muted); font-size: .92rem; line-height: 1.7; margin: 0; }

/* ============================================================
   Admin Search
   ============================================================ */
.admin-search       { display: flex; gap: 10px; margin-bottom: 20px; align-items: center; flex-wrap: wrap; }
.admin-search input { flex: 1; min-width: 200px; padding: 9px 14px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: .9rem; font-family: inherit; }
.admin-search input:focus { outline: none; border-color: var(--primary); }

/* ============================================================
   Header Search
   ============================================================ */
.header-search {
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 360px;
    margin: 0 20px;
}
.header-search input {
    flex: 1;
    padding: 7px 12px;
    border: none;
    border-radius: var(--radius) 0 0 var(--radius);
    font-size: .88rem;
    outline: none;
    color: var(--text);
}
.header-search button {
    padding: 7px 12px;
    background: var(--accent);
    border: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    color: #fff;
    cursor: pointer;
    font-size: .95rem;
    transition: background var(--trans);
}
.header-search button:hover { background: var(--accent-hov); }

/* Search Page */
.search-form-wrap    { margin: 10px 0 30px; }
.search-form-inner   { display: flex; gap: 10px; }
.search-input-lg     {
    flex: 1;
    padding: 11px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text);
}
.search-input-lg:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30,58,95,.1);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
    .states-grid    { grid-template-columns: repeat(4,1fr); }
    .listings-grid  { grid-template-columns: repeat(2,1fr); }
    .info-grid      { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 768px) {
    .states-grid    { grid-template-columns: repeat(3,1fr); }
    .listings-grid  { grid-template-columns: 1fr; }
    .info-grid      { grid-template-columns: 1fr; }
    .hero h1        { font-size: 1.8rem; }
    .hero           { padding: 42px 0; }
    .form-card      { padding: 24px 18px; }
    .header-inner   { flex-direction: column; gap: 10px; }
    .header-search  { max-width: 100%; margin: 0; width: 100%; }
    .steps-grid     { grid-template-columns: 1fr; }
    .admin-table    { display: block; overflow-x: auto; }
}

@media (max-width: 480px) {
    .states-grid    { grid-template-columns: repeat(2,1fr); }
    .admin-stats    { grid-template-columns: 1fr; }
    .submit-cta     { padding: 24px 18px; }
    .thankyou-card  { padding: 34px 20px; }
}
