/* ========================================
   HSP Affiliate Tracker - Stylesheet
   ======================================== */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: #f5f7fa;
    color: #1a1a2e;
    line-height: 1.6;
}

/* ---- Navbar ---- */
.navbar {
    background: #1a1a2e;
    color: #fff;
    padding: 0 24px;
    display: flex;
    align-items: center;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.nav-brand a {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 18px;
    margin-right: 32px;
}
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}
.nav-links a:hover { color: #fff; background: rgba(255,255,255,0.1); }
.nav-links a.active { color: #fff; background: rgba(255,255,255,0.15); }
.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: rgba(255,255,255,0.8);
}

/* ---- Container ---- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* ---- Page Header ---- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h1 { font-size: 28px; font-weight: 700; }

.page-description {
    color: #666;
    margin-bottom: 20px;
    font-size: 15px;
}

/* ---- Buttons ---- */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-outline { background: transparent; color: #2563eb; border: 1.5px solid #2563eb; }
.btn-outline:hover { background: #2563eb; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-full { width: 100%; }

/* ---- Stats Grid ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    text-align: center;
}
.stat-number { font-size: 32px; font-weight: 700; color: #2563eb; }
.stat-label { font-size: 14px; color: #666; margin-top: 4px; }
.stat-detail { font-size: 12px; color: #999; margin-top: 4px; }

/* ---- Section ---- */
.section {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.section h2 { font-size: 20px; font-weight: 600; margin-bottom: 16px; }

/* ---- Tables ---- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th {
    text-align: left;
    padding: 12px 16px;
    background: #f8fafc;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}
.data-table td {
    padding: 10px 16px;
    border-bottom: 1px solid #f1f3f5;
    vertical-align: middle;
}
.data-table tbody tr:hover { background: #f8fafc; }
.data-table.compact td, .data-table.compact th { padding: 8px 12px; }

/* ---- Badges ---- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-gray { background: #f3f4f6; color: #4b5563; }
.badge-lg { font-size: 14px; padding: 5px 14px; }

/* ---- Forms ---- */
.form-container {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    max-width: 800px;
}
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
    color: #374151;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-group small { display: block; margin-top: 4px; color: #9ca3af; font-size: 12px; }
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* ---- Search Bar ---- */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}
.search-bar input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
}
.search-bar input:focus { outline: none; border-color: #2563eb; }

/* ---- Tab Bar ---- */
.tab-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0;
}
.tab {
    padding: 10px 20px;
    text-decoration: none;
    color: #666;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.tab:hover { color: #2563eb; }
.tab.active { color: #2563eb; border-bottom-color: #2563eb; }

/* ---- Pagination ---- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}
.page-info { font-size: 14px; color: #666; }

/* ---- Detail Grid ---- */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}
.detail-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.detail-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.detail-card dl { display: grid; grid-template-columns: 120px 1fr; gap: 8px; font-size: 14px; }
.detail-card dt { color: #666; font-weight: 600; }
.detail-card dd { color: #1a1a2e; }

/* ---- Action Grid ---- */
.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}
.action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #f8fafc;
    border-radius: 12px;
    text-decoration: none;
    color: #2563eb;
    border: 1.5px solid #e5e7eb;
    transition: all 0.2s;
}
.action-card:hover { border-color: #2563eb; background: #eff6ff; }
.action-icon { font-size: 28px; margin-bottom: 8px; }
.action-label { font-weight: 600; font-size: 14px; }

/* ---- Commission Total ---- */
.commission-total {
    text-align: right;
    padding: 16px;
    font-size: 18px;
    border-top: 2px solid #e5e7eb;
    margin-top: 8px;
}

/* ---- Alerts ---- */
.alert {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #9ca3af;
    font-size: 15px;
}
.empty-state a { color: #2563eb; }

/* ---- Login ---- */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}
.login-box {
    background: #fff;
    border-radius: 16px;
    padding: 48px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 420px;
}
.login-box h1 { text-align: center; font-size: 24px; margin-bottom: 8px; }
.login-subtitle { text-align: center; color: #666; margin-bottom: 32px; font-size: 15px; }

/* ---- Utilities ---- */
.text-muted { color: #9ca3af; }

/* ---- Footer ---- */
.footer {
    text-align: center;
    padding: 24px;
    color: #9ca3af;
    font-size: 13px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .navbar { flex-wrap: wrap; height: auto; padding: 12px; }
    .nav-links { order: 3; width: 100%; overflow-x: auto; padding-top: 8px; }
    .form-row { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .data-table { font-size: 13px; }
    .data-table th, .data-table td { padding: 8px 10px; }
}
