/* =============================================================================
   portal.css: Styles for login.html and dashboard.html
   Extends style.css; requires style.css to be loaded first.
   ============================================================================= */

/* ---- Shared portal layout ---- */
.portal-wrap {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 60px 5%;
}

/* ---- Login page ---- */
.login-box {
    background: var(--card-bg);
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.login-box h1 {
    font-size: 1.6rem;
    margin-bottom: 8px;
}

.login-box .sub {
    color: #8b949e;
    font-size: 0.9rem;
    margin-bottom: 28px;
}

.portal-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.portal-form input {
    background: #0d1117;
    border: 1px solid #30363d;
    padding: 14px;
    color: white;
    border-radius: 6px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.portal-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.portal-form .form-label {
    font-size: 0.8rem;
    color: #8b949e;
    margin-bottom: 4px;
    font-family: var(--font-mono);
}

.portal-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

button.btn-portal {
    background: var(--accent);
    color: white;
    padding: 13px 24px;
    border-radius: 6px;
    border: none;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 0 15px var(--accent-glow);
    transition: opacity 0.2s ease;
    font-family: var(--font-sans);
    margin-top: 4px;
}

button.btn-portal:hover { opacity: 0.9; }
button.btn-portal:disabled { opacity: 0.5; cursor: not-allowed; }

.portal-note {
    font-size: 0.82rem;
    color: #484f58;
    margin-top: 16px;
    text-align: center;
}

.portal-note a { color: var(--accent); text-decoration: none; }

.portal-status {
    display: none;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.88rem;
}

.portal-status.error {
    background: rgba(218, 54, 51, 0.15);
    border: 1px solid #da3633;
    color: #f85149;
    display: block;
}

.portal-status.success {
    background: rgba(35, 134, 54, 0.15);
    border: 1px solid #238636;
    color: #3fb950;
    display: block;
}

/* ---- Dashboard ---- */
.dashboard-wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 60px 5%;
    width: 100%;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 16px;
}

.dashboard-header h1 {
    font-size: 1.8rem;
    margin-bottom: 4px;
}

.dashboard-header .sub {
    color: #8b949e;
    font-size: 0.9rem;
}

.grafana-btn {
    background: var(--accent);
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9rem;
    box-shadow: 0 0 15px var(--accent-glow);
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

.grafana-btn:hover { opacity: 0.9; }

/* Stat bar */
.stat-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 36px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--accent);
    font-family: var(--font-mono);
}

.stat-card .stat-label {
    font-size: 0.78rem;
    color: #8b949e;
    margin-top: 4px;
    font-family: var(--font-mono);
}

/* Section headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-title {
    font-family: var(--font-mono);
    color: var(--accent);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Server table */
.server-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 36px;
    font-size: 0.9rem;
}

.server-table th {
    text-align: left;
    padding: 10px 12px;
    color: #8b949e;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    border-bottom: 1px solid #30363d;
    font-weight: normal;
}

.server-table td {
    padding: 12px;
    border-bottom: 1px solid #21262d;
    color: var(--text-main);
}

.server-table tr:last-child td { border-bottom: none; }

.server-table tr:hover td { background: #161b22; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
}

.badge-active {
    background: rgba(35, 134, 54, 0.2);
    color: #3fb950;
    border: 1px solid #238636;
}

.badge-pending {
    background: rgba(210, 153, 34, 0.2);
    color: #e3b341;
    border: 1px solid #9e6a03;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #484f58;
    font-size: 0.9rem;
    background: var(--card-bg);
    border: 1px solid #30363d;
    border-radius: 8px;
    margin-bottom: 36px;
}

/* Add server panel */
.add-server-panel {
    background: var(--card-bg);
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 28px;
    margin-bottom: 36px;
}

.add-server-panel h3 {
    font-size: 1rem;
    margin-bottom: 20px;
    color: var(--text-main);
}

.add-server-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.add-server-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 10px;
    align-items: center;
}

.add-server-row input,
.add-server-row select {
    background: #0d1117;
    border: 1px solid #30363d;
    padding: 10px 12px;
    color: white;
    border-radius: 6px;
    font-family: var(--font-sans);
    font-size: 0.88rem;
    transition: border-color 0.2s ease;
}

.add-server-row input:focus,
.add-server-row select:focus {
    outline: none;
    border-color: var(--accent);
}

.add-server-row select option { background: var(--card-bg); }

.btn-remove-row {
    background: none;
    border: 1px solid #da3633;
    color: #f85149;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-remove-row:hover { background: rgba(218,54,51,0.15); }

.btn-add-row {
    background: none;
    border: 1px dashed #30363d;
    color: #8b949e;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.88rem;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
    width: 100%;
    text-align: center;
    font-family: var(--font-sans);
    background-color: transparent;
}

.btn-add-row:hover { border-color: var(--accent); color: var(--accent); }

.add-server-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    align-items: center;
}

.btn-submit-servers {
    background: var(--accent);
    color: white;
    padding: 11px 22px;
    border-radius: 6px;
    border: none;
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: opacity 0.2s ease;
}

.btn-submit-servers:hover { opacity: 0.9; }
.btn-submit-servers:disabled { opacity: 0.5; cursor: not-allowed; }

/* Logout link */
.logout-link {
    font-size: 0.82rem;
    color: #484f58;
    cursor: pointer;
    text-decoration: none;
    font-family: var(--font-mono);
    transition: color 0.2s ease;
}

.logout-link:hover { color: #f85149; }

@media (max-width: 600px) {
    .stat-bar { grid-template-columns: 1fr; }
    .add-server-row { grid-template-columns: 1fr; }
    .dashboard-header { flex-direction: column; }
    .server-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .team-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .bootstrap-cmd { font-size: 0.7rem; }
    .dashboard-wrap { padding: 30px 4%; }
}

/* =============================================================================
   Bootstrap command section (dashboard.html)
   ============================================================================= */

.bootstrap-section { margin-top: 32px; }

.bootstrap-server-block {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
}

.bootstrap-server-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #161b22;
    border-bottom: 1px solid #30363d;
}

.bootstrap-server-name {
    font-family: var(--font-mono);
    color: var(--accent);
    font-size: 0.9rem;
}

.bootstrap-server-meta {
    font-size: 0.78rem;
    color: #484f58;
}

.bootstrap-cmd {
    padding: 14px 16px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: #e6edf3;
    line-height: 1.8;
    white-space: pre;
    overflow-x: auto;
}

.bootstrap-cmd-footer {
    display: flex;
    justify-content: flex-end;
    padding: 8px 16px 12px;
    gap: 10px;
}

.btn-copy {
    background: transparent;
    border: 1px solid #30363d;
    color: #8b949e;
    padding: 5px 14px;
    border-radius: 5px;
    font-size: 0.8rem;
    cursor: pointer;
    font-family: var(--font-mono);
    transition: border-color 0.2s, color 0.2s;
}

.btn-copy:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-copy.copied {
    border-color: #3fb950;
    color: #3fb950;
}

.bootstrap-notice {
    background: #161b22;
    border: 1px solid #30363d;
    border-left: 3px solid #58a6ff;
    border-radius: 6px;
    padding: 12px 16px;
    font-size: 0.85rem;
    color: #8b949e;
    margin-bottom: 20px;
    line-height: 1.6;
}

.bootstrap-error {
    color: #f85149;
    font-size: 0.85rem;
    padding: 12px 0;
}

.commands-loading {
    color: #8b949e;
    font-size: 0.85rem;
    padding: 12px 0;
}

/* ---- Upgrade banner (free tier users) ---- */
.upgrade-banner {
    background: linear-gradient(135deg, rgba(88, 166, 255, 0.08), rgba(88, 166, 255, 0.03));
    border: 1px solid var(--accent);
    border-radius: 10px;
    padding: 24px 28px;
    margin-bottom: 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.upgrade-banner-text h3 {
    font-size: 1rem;
    color: var(--text-main);
    margin-bottom: 6px;
}

.upgrade-banner-text p {
    font-size: 0.88rem;
    color: #8b949e;
    line-height: 1.5;
    margin: 0;
}

.btn-upgrade {
    background: var(--accent);
    color: white;
    padding: 11px 22px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.88rem;
    white-space: nowrap;
    box-shadow: 0 0 15px var(--accent-glow);
    transition: opacity 0.2s ease;
}

.btn-upgrade:hover { opacity: 0.85; }

@media (max-width: 600px) {
    .upgrade-banner {
        flex-direction: column;
        text-align: center;
    }
}

/* =============================================================================
   Team management section (dashboard.html)
   ============================================================================= */
 
.team-section {
    margin-top: 36px;
    margin-bottom: 36px;
}
 
.team-count {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: #8b949e;
}
 
.team-table th:last-child,
.team-table td:last-child {
    text-align: right;
    width: 80px;
}
 
.badge-owner {
    background: rgba(88, 166, 255, 0.15);
    color: var(--accent);
    border: 1px solid rgba(88, 166, 255, 0.3);
}
 
.btn-remove-user {
    background: none;
    border: 1px solid #da3633;
    color: #f85149;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    font-family: var(--font-mono);
    transition: background 0.2s ease;
}
 
.btn-remove-user:hover {
    background: rgba(218, 54, 51, 0.15);
}
 
.add-user-panel {
    background: var(--card-bg);
    border: 1px solid #30363d;
    border-radius: 10px;
    padding: 20px;
    margin-top: 16px;
}
 
.team-input {
    background: #0d1117;
    border: 1px solid #30363d;
    padding: 10px 12px;
    color: white;
    border-radius: 6px;
    font-family: var(--font-sans);
    font-size: 0.88rem;
    transition: border-color 0.2s ease;
    width: 100%;
}
 
.team-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}
 
.btn-add-user {
    background: var(--accent);
    color: white;
    padding: 10px 18px;
    border-radius: 6px;
    border: none;
    font-weight: bold;
    font-size: 0.88rem;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: opacity 0.2s ease;
    white-space: nowrap;
    height: fit-content;
}
 
.btn-add-user:hover { opacity: 0.9; }
.btn-add-user:disabled { opacity: 0.5; cursor: not-allowed; }
 
.team-limit-msg {
    text-align: center;
    padding: 12px;
    color: #8b949e;
    font-size: 0.85rem;
    margin-top: 12px;
}
 
.team-limit-msg a {
    color: var(--accent);
    text-decoration: none;
}
 
@media (max-width: 600px) {
    .add-user-panel > div {
        grid-template-columns: 1fr;
    }
}

/* ---- Server remove button ---- */
.btn-remove-alloy {
    background: none;
    border: 1px solid #388bfd;
    color: #58a6ff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    font-family: var(--font-mono);
    transition: background 0.2s ease;
}
.btn-remove-alloy:hover {
    background: rgba(56, 139, 253, 0.15);
}

.btn-remove-server {
    background: none;
    border: 1px solid #da3633;
    color: #f85149;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    font-family: var(--font-mono);
    transition: background 0.2s ease;
}

.btn-remove-server:hover {
    background: rgba(218, 54, 51, 0.15);
}
