/* ═══════════════════════════════════════════════════
   Renewals Page — Contract Tracker Styling
   ═══════════════════════════════════════════════════ */

.renewals-page {
    max-width: 1200px;
    margin: 0 auto;
}

/* ─── Header ──────────────────────────────────────── */
.renewals-header {
    margin-bottom: 24px;
}

.renewals-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: #e4e6eb;
    margin: 0 0 4px;
}

.renewals-subtitle {
    color: #8b8d94;
    font-size: 13px;
    margin: 0;
}

/* ─── Stats Cards ─────────────────────────────────── */
.renewals-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: #1e2030;
    border: 1px solid #2d3045;
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: #8b8d94;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stat-danger .stat-value {
    color: #ff5c5c;
}

.stat-warning .stat-value {
    color: #ffb347;
}

.stat-caution .stat-value {
    color: #ffd700;
}

.stat-safe .stat-value {
    color: #52d49a;
}

.stat-total .stat-value {
    color: #6c8dfa;
}

/* ─── Filters ─────────────────────────────────────── */
.renewals-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 6px 14px;
    border: 1px solid #3d4060;
    border-radius: 20px;
    background: transparent;
    color: #b0b3c0;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: #2d3050;
    color: #e4e6eb;
}

.filter-btn.active {
    background: #4a5580;
    border-color: #6c8dfa;
    color: #fff;
}

/* ─── Table ───────────────────────────────────────── */
.renewals-table-wrap {
    overflow-x: auto;
}

.renewals-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.renewals-table thead th {
    text-align: left;
    padding: 10px 12px;
    background: #1a1c2e;
    color: #8b8d94;
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #2d3045;
    position: sticky;
    top: 0;
    z-index: 1;
}

.renewals-table tbody tr {
    border-bottom: 1px solid #23253a;
    cursor: pointer;
    transition: background 0.15s;
}

.renewals-table tbody tr:hover {
    background: #252740;
}

.renewals-table td {
    padding: 10px 12px;
    color: #d0d2db;
    white-space: nowrap;
}

.col-code {
    min-width: 90px;
}

.col-name {
    min-width: 140px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.col-package {
    min-width: 100px;
}

.col-end {
    min-width: 100px;
}

.col-days {
    min-width: 100px;
}

.col-value {
    min-width: 90px;
    text-align: right;
}

.col-health {
    min-width: 60px;
    text-align: center;
}

.col-owner {
    min-width: 90px;
}

/* Urgency row backgrounds */
.urgency-expired {
    background: rgba(255, 92, 92, 0.08) !important;
}

.urgency-critical {
    background: rgba(255, 179, 71, 0.08) !important;
}

/* Health score colors */
.health-good {
    color: #52d49a;
    font-weight: 600;
}

.health-warn {
    color: #ffd700;
    font-weight: 600;
}

.health-bad {
    color: #ff5c5c;
    font-weight: 600;
}

/* Urgency badges */
.badge-expired,
.badge-critical,
.badge-warning,
.badge-safe,
.badge-neutral {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-expired {
    background: rgba(255, 92, 92, .15);
    color: #ff5c5c;
}

.badge-critical {
    background: rgba(255, 179, 71, .15);
    color: #ffb347;
}

.badge-warning {
    background: rgba(255, 215, 0, .12);
    color: #ffd700;
}

.badge-safe {
    background: rgba(82, 212, 154, .12);
    color: #52d49a;
}

.badge-neutral {
    background: rgba(139, 141, 148, .12);
    color: #8b8d94;
}

/* Actions */
.btn-edit {
    padding: 4px 8px;
    background: transparent;
    border: 1px solid #3d4060;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-edit:hover {
    background: #2d3050;
    border-color: #6c8dfa;
}

/* ─── Empty State ─────────────────────────────────── */
.renewals-empty {
    text-align: center;
    padding: 60px 20px;
    color: #8b8d94;
    font-size: 15px;
}

.renewals-count {
    padding: 10px 12px;
    color: #6b6e7a;
    font-size: 12px;
    text-align: right;
}

/* ─── Modal ───────────────────────────────────────── */
.renewal-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, .6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
}

.renewal-modal {
    background: #1e2030;
    border: 1px solid #2d3045;
    border-radius: 14px;
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.renewal-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid #2d3045;
}

.renewal-modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #e4e6eb;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: #8b8d94;
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.modal-close:hover {
    color: #ff5c5c;
}

.renewal-modal-body {
    padding: 20px 24px;
}

/* ─── Form ────────────────────────────────────────── */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 12px;
    color: #8b8d94;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    background: #151728;
    border: 1px solid #2d3045;
    border-radius: 8px;
    color: #e4e6eb;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: #6c8dfa;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #2d3045;
}

.btn-cancel {
    padding: 8px 20px;
    background: transparent;
    border: 1px solid #3d4060;
    border-radius: 8px;
    color: #b0b3c0;
    cursor: pointer;
    font-size: 14px;
}

.btn-cancel:hover {
    background: #2d3050;
}

.btn-save {
    padding: 8px 24px;
    background: #6c8dfa;
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-save:hover {
    background: #5a7de8;
}

/* ─── Loading Spinner ─────────────────────────────── */
.loading-spinner {
    text-align: center;
    padding: 40px;
    color: #8b8d94;
}

/* ─── Responsive ──────────────────────────────────── */
@media (max-width: 768px) {
    .renewals-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .renewals-table {
        font-size: 12px;
    }

    .col-package,
    .col-owner {
        display: none;
    }
}