/* ============================================================
   style.css — Domain Portal
   ============================================================ */

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

:root {
    --blue:        #185FA5;
    --blue-light:  #E6F1FB;
    --blue-mid:    #B5D4F4;
    --green:       #3B6D11;
    --green-light: #EAF3DE;
    --red:         #A32D2D;
    --red-light:   #FCEBEB;
    --amber:       #854F0B;
    --amber-light: #FAEEDA;
    --gray-bg:     #F5F6F8;
    --gray-border: #DEE2E8;
    --gray-text:   #6B7280;
    --dark:        #1A1A2E;
    --white:       #FFFFFF;
    --text:        #111827;
    --radius:      8px;
    --radius-lg:   12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--gray-bg);
    min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Topbar ───────────────────────────────────── */
.topbar {
    background: var(--dark);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 54px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-logo {
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.topbar-logo span {
    color: #7B9FD4;
    font-weight: 400;
    font-size: 13px;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}
.topbar-right a {
    color: #aaa;
    font-size: 13px;
}
.topbar-right a:hover { color: #fff; text-decoration: none; }
.topbar-user {
    font-size: 13px;
    color: #ccc;
}

/* ── Page container ───────────────────────────── */
.container {
    max-width: 1340px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* ── Stat cards ───────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--white);
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
}
.stat-label { font-size: 12px; color: var(--gray-text); margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-sub   { font-size: 11px; color: #9CA3AF; margin-top: 4px; }
.stat-card.danger  .stat-value { color: var(--red); }
.stat-card.success .stat-value { color: var(--green); }
.stat-card.info    .stat-value { color: var(--blue); }

/* ── Tabs ─────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--gray-border);
}
.tab {
    padding: 9px 18px;
    font-size: 13px;
    color: var(--gray-text);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    text-decoration: none;
    transition: color 0.12s;
    white-space: nowrap;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active {
    color: var(--blue);
    border-bottom-color: var(--blue);
    font-weight: 500;
}

/* ── Toolbar ──────────────────────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.toolbar-left  { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; align-items: center; }
.toolbar-right { display: flex; gap: 8px; align-items: center; }

.search-box {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--white);
    border: 1px solid var(--gray-border);
    border-radius: var(--radius);
    padding: 0 10px;
    min-width: 200px;
    flex: 1;
    max-width: 320px;
}
.search-box svg { color: var(--gray-text); flex-shrink: 0; }
.search-box input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
    padding: 8px 0;
    width: 100%;
    color: var(--text);
    box-shadow: none;
}

/* ── Form elements ────────────────────────────── */
select,
input[type="text"],
input[type="email"],
input[type="date"],
input[type="number"],
input[type="password"],
textarea {
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    background: var(--white);
    border: 1px solid var(--gray-border);
    border-radius: var(--radius);
    padding: 8px 10px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}
select:focus,
input:focus,
textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(24,95,165,0.12);
}
textarea { resize: vertical; min-height: 75px; }
select { cursor: pointer; }

/* ── Buttons ──────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--gray-border);
    background: var(--white);
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s, border-color 0.12s, opacity 0.12s;
    text-decoration: none;
    line-height: 1;
}
.btn:hover { background: #F3F4F6; text-decoration: none; }
.btn-primary  { background: var(--blue);  color: #fff; border-color: var(--blue); }
.btn-primary:hover  { background: #145290; }
.btn-success  { background: var(--green); color: #fff; border-color: var(--green); }
.btn-success:hover  { background: #2D560D; }
.btn-danger   { background: var(--red);   color: #fff; border-color: var(--red); }
.btn-danger:hover   { background: #8A2424; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon {
    padding: 6px 8px;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1;
}

/* ── Bulk action bar ──────────────────────────── */
.bulk-bar {
    display: none;
    align-items: center;
    gap: 10px;
    background: var(--blue-light);
    border: 1px solid var(--blue-mid);
    border-radius: var(--radius);
    padding: 8px 14px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--blue);
    flex-wrap: wrap;
}
.bulk-bar.active { display: flex; }
.bulk-bar strong { font-weight: 600; }
.bulk-divider { width: 1px; height: 18px; background: var(--blue-mid); }

/* ── Table card ───────────────────────────────── */
.table-card {
    background: var(--white);
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.table-responsive { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 960px;
}
thead th {
    padding: 10px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #F9FAFB;
    border-bottom: 1px solid var(--gray-border);
    white-space: nowrap;
}
thead th a {
    color: var(--gray-text);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}
thead th a:hover { color: var(--text); }

tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #F3F4F6;
    vertical-align: middle;
    font-size: 13px;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #FAFBFC; }
tbody tr.row-selected td { background: var(--blue-light); }
tbody tr.expiring-soon td { background: #FFFBEB; }
tbody tr.row-expired td { background: #FEF2F2; }

.domain-name { font-weight: 500; color: var(--text); }
.cell-muted  { font-size: 12px; color: var(--gray-text); }
.cell-email-list { font-size: 11px; color: var(--gray-text); line-height: 1.7; margin-top: 3px; }

/* ── Badges ───────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1.4;
}
.badge-yes       { background: var(--green-light); color: var(--green); }
.badge-no        { background: var(--red-light);   color: var(--red); }
.badge-normal    { background: #F3F4F6;  color: #374151; }
.badge-warning   { background: var(--amber-light); color: var(--amber); }
.badge-danger    { background: var(--red-light);   color: var(--red); }
.badge-expired   { background: #4B5563;  color: #fff; }
.badge-neutral   { background: #F3F4F6;  color: var(--gray-text); }
.badge-exabytes  { background: #FFF3CD;  color: #856404; }
.badge-namecheap { background: var(--blue-light);  color: var(--blue); }
.badge-hostinger { background: var(--green-light); color: var(--green); }
.badge-other     { background: #F3F4F6;  color: #374151; }
.badge-email-yes { background: #EDE9FE;  color: #5B21B6; }

/* ── Pagination ───────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--gray-border);
    font-size: 13px;
    color: var(--gray-text);
    flex-wrap: wrap;
    gap: 8px;
}
.page-links { display: flex; gap: 4px; }
.page-links a,
.page-links span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--radius);
    border: 1px solid var(--gray-border);
    font-size: 13px;
    color: var(--text);
    text-decoration: none;
}
.page-links a:hover { background: var(--gray-bg); }
.page-links span.current { background: var(--blue); color: #fff; border-color: var(--blue); }
.page-links span.dots { border: none; color: var(--gray-text); }

/* ── Modal overlay ────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 200;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
}
.modal-overlay.active { display: flex; }

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 580px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
    margin: auto;
}
.modal-sm { max-width: 420px; }

.modal-header {
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--gray-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 600; color: var(--text); }
.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-text);
    font-size: 22px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
}
.modal-close:hover { background: var(--gray-bg); color: var(--text); }

.modal-body { padding: 20px 22px; }

.modal-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--gray-border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}
.modal-footer .btn-danger { margin-right: auto; }

/* ── Form layout inside modals ────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 12px; font-weight: 500; color: var(--gray-text); }
.form-hint { font-size: 11px; color: #9CA3AF; margin-top: 3px; }

/* ── Email tag input ──────────────────────────── */
.email-tag-wrap {
    border: 1px solid var(--gray-border);
    border-radius: var(--radius);
    padding: 6px 8px;
    min-height: 82px;
    cursor: text;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: flex-start;
    background: var(--white);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.email-tag-wrap:focus-within {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(24,95,165,0.12);
}
.email-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--blue-light);
    color: var(--blue);
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 500;
}
.email-tag button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--blue);
    font-size: 15px;
    line-height: 1;
    padding: 0;
    opacity: 0.7;
}
.email-tag button:hover { opacity: 1; }
.email-tag-wrap input {
    border: none;
    outline: none;
    padding: 3px 4px;
    font-size: 12px;
    min-width: 180px;
    flex: 1;
    box-shadow: none;
    background: transparent;
    color: var(--text);
    width: auto;
}

/* ── Renew modal ──────────────────────────────── */
.renew-domains-box {
    background: #F9FAFB;
    border: 1px solid var(--gray-border);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 13px;
    white-space: pre-line;
    line-height: 1.9;
    max-height: 180px;
    overflow-y: auto;
    color: var(--text);
}
.renew-group {
    display: flex;
    align-items: center;
    gap: 10px;
}
.renew-group input[type="number"] { width: 80px; }
.renew-note {
    font-size: 12px;
    color: var(--gray-text);
    background: var(--blue-light);
    border-radius: var(--radius);
    padding: 8px 12px;
    margin-top: 10px;
    line-height: 1.5;
}

/* ── Alerts / flash ───────────────────────────── */
.alert {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
}
.alert-success { background: var(--green-light); color: var(--green); border: 1px solid #C0DD97; }
.alert-danger  { background: var(--red-light);   color: var(--red);   border: 1px solid #F09595; }

/* ── Login page ───────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-bg);
    padding: 20px;
}
.login-card {
    background: var(--white);
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    width: 100%;
    max-width: 380px;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--dark); }
.login-logo p  { font-size: 12px; color: var(--gray-text); margin-top: 5px; }
.login-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-text);
    margin-top: 10px;
}
.login-remember input { width: auto; }

/* ── Responsive ───────────────────────────────── */
@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-right { justify-content: flex-end; }
    .tabs { overflow-x: auto; }
}
