/* ============================================================
   IP Address Lookup – Professional Card UI
   ============================================================ */
:root {
    --bg: #f4f6f9;
    --card-bg: #ffffff;
    --text: #1a1a2e;
    --text-secondary: #4a4a6a;
    --border: #e2e8f0;
    --shadow: 0 8px 24px rgba(0,0,0,0.06);
    --red: #db0601;
    --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --table-bg: #fff;
    --table-text: #1a1a2e;
    --table-stripe: #f8fafc;
}

[data-theme="dark"] {
    --bg: #0f1117;
    --card-bg: #1c1e26;
    --text: #e4e6f0;
    --text-secondary: #a0a4b8;
    --border: #2e3140;
    --shadow: 0 8px 24px rgba(0,0,0,0.4);
    --table-bg: #1c1e26;
    --table-text: #e4e6f0;
    --table-stripe: #2a2d37;
}

* { box-sizing: border-box; }
body { background: var(--bg); margin: 0; font-family: var(--font); color: var(--text); transition: background 0.3s, color 0.3s; }

.ipal-page-container { width: 100%; max-width: 1200px; margin: 30px auto; padding: 0 20px; display: flex; flex-direction: column; gap: 30px; }
.ipal-card-view { background: var(--card-bg); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); border: 1px solid var(--border); margin-bottom: 20px; }
.ipal-short-grid, .ipal-full-grid { display: flex; flex-wrap: wrap; gap: 30px; }
.ipal-short-left, .ipal-full-left { flex: 1 1 60%; min-width: 280px; }
.ipal-short-right, .ipal-full-right { flex: 1 1 35%; min-width: 280px; display: flex; flex-direction: column; gap: 20px; }
.ipal-card-header-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.ipal-card-header-row h5, .ipal-full-header h5 { font-size: 1.4rem; font-weight: 700; margin: 0; color: var(--text); }
.ipal-full-header { text-align: center; }
.ipal-action-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.ipal-icon-btn { background: rgba(128,128,128,0.1); border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; color: var(--text); cursor: pointer; font-size: 0.9rem; transition: background 0.2s, transform 0.1s; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.ipal-icon-btn:hover { background: rgba(128,128,128,0.25); transform: translateY(-1px); }
.ipal-red-btn { display: block; width: 100%; background: var(--red); color: #fff; font-weight: 700; font-size: 1rem; text-align: center; padding: 14px 20px; border-radius: 12px; text-decoration: none; border: none; cursor: pointer; transition: background 0.2s, transform 0.1s; letter-spacing: 0.3px; }
.ipal-red-btn:hover { background: #b80501; transform: scale(1.02); color: #fff; }
.ipal-blue-btn { display: block; width: 100%; background: #003a87; color: #fff; font-weight: 700; font-size: 1rem; text-align: center; padding: 14px 20px; border-radius: 12px; text-decoration: none; border: none; cursor: pointer; transition: background 0.2s, transform 0.1s; letter-spacing: 0.3px; }
.ipal-blue-btn:hover { background: #002c66; transform: scale(1.02); color: #fff; }

/* Table */
#bilp-results-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 0.9rem; background: var(--table-bg); color: var(--table-text); }
#bilp-results-table th, #bilp-results-table td { border: 1px solid var(--border); padding: 8px; text-align: left; }
#bilp-results-table th { background: var(--bg); font-weight: 600; }
#bilp-results-table tbody tr:nth-child(even) { background: var(--table-stripe); }
#bilp-results-table tbody tr:hover { background: rgba(0,0,0,0.03); }
[data-theme="dark"] #bilp-results-table tbody tr:hover { background: rgba(255,255,255,0.05); }

/* Dark/Light Toggle */
.theme-toggle { background: none; border: 1px solid var(--border); border-radius: 20px; padding: 4px 12px; cursor: pointer; font-size: 0.8rem; display: flex; align-items: center; gap: 4px; }

/* Search/Filter */
#bilp-filter-input { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; width: 200px; font-size: 0.9rem; background: var(--card-bg); color: var(--text); }

/* Map modal */
#bilp-map-modal { display: none; position: fixed; z-index: 9999; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); }
#bilp-map-modal .modal-content { background: var(--card-bg); margin: 5% auto; padding: 20px; width: 80%; max-width: 800px; border-radius: 16px; position: relative; }
#bilp-map-modal .close-modal { position: absolute; top: 10px; right: 20px; font-size: 2rem; cursor: pointer; color: var(--text); }
#bilp-map-container { height: 400px; width: 100%; border-radius: 12px; }
#bilp-all-map { height: 400px; width: 100%; border-radius: 12px; margin-top: 20px; }

/* Progress overlay */
#bilp-progress { display: none; position: fixed; z-index: 9999; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255,255,255,0.85); text-align: center; padding-top: 20%; font-weight: bold; font-size: 1.2rem; }
[data-theme="dark"] #bilp-progress { background: rgba(0,0,0,0.85); color: var(--text); }
.spinner { border: 4px solid #f3f3f3; border-top: 4px solid var(--red); border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; margin: 0 auto 15px; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.progress-bar-container { width: 100%; background: var(--border); border-radius: 10px; margin: 15px 0; height: 10px; }
.progress-bar-fill { width: 0%; height: 100%; background: var(--red); border-radius: 10px; transition: width 0.3s; }

/* Responsive */
@media (max-width: 900px) { .ipal-short-grid, .ipal-full-grid { flex-direction: column; } }
@media (max-width: 600px) { .ipal-page-container { margin: 15px auto; padding: 0 12px; gap: 20px; } .ipal-card-view { padding: 18px; } }

.ipal-short-left, .ipal-short-right, .ipal-full-left, .ipal-full-right > *, .ipal-card-view { animation: fadeUp 0.5s ease forwards; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* Small button for map */
.bilp-btn-sm { padding: 4px 10px; font-size: 0.8rem; background: #003a87; color: #fff; border: none; border-radius: 6px; cursor: pointer; }
.bilp-btn-sm:hover { background: #002c66; }