/* Auth Service - Admin Dashboard Styles */

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

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

/* Layout */
.layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: #1a1a2e;
    color: #ccc;
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #2d2d44;
}

.sidebar-header h1 {
    font-size: 18px;
    color: #fff;
    font-weight: 600;
}

.sidebar-nav {
    padding: 10px 0;
}

.nav-link {
    display: block;
    padding: 12px 20px;
    color: #aaa;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    font-size: 14px;
}

.nav-link:hover,
.nav-link.active {
    background: #16213e;
    color: #fff;
}

/* Content */
.content {
    flex: 1;
    margin-left: 240px;
    padding: 30px;
}

.content h2 {
    margin-bottom: 20px;
    color: #1a1a2e;
    font-size: 24px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a2e;
}

.stat-label {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
}

/* Panels */
.panel {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.panel h3 {
    margin-bottom: 16px;
    color: #1a1a2e;
    font-size: 16px;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tr:hover {
    background: #f8f9fa;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.4;
    height: 38px;
    background: #fff;
    color: #333;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23555' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1a1a2e;
    box-shadow: 0 0 0 2px rgba(26, 26, 46, 0.1);
}

.form-inline {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.form-inline input {
    width: auto;
    flex: 1;
}

.inline-form {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.inline-form .form-group {
    flex: 1;
    min-width: 180px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    height: 38px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1;
}

.btn-primary {
    background: #1a1a2e;
    color: #fff;
}

.btn-primary:hover {
    background: #16213e;
}

.btn-secondary {
    background: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: #fff;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-small {
    padding: 5px 10px;
    height: 28px;
    font-size: 12px;
}

.btn-block {
    display: flex;
    width: 100%;
    text-align: center;
}

.btn-copy {
    background: #e9ecef;
    color: #333;
}

.btn-copy:hover {
    background: #dee2e6;
}

.btn-edit {
    background: #0d6efd;
    color: #fff;
}

.btn-edit:hover {
    background: #0b5ed7;
}

/* Flash Messages */
.flash {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.flash-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.flash-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Text colours */
.text-success { color: #28a745; }
.text-danger { color: #dc3545; }
.text-muted { color: #888; font-size: 13px; }

/* API Key */
.api-key-masked {
    font-family: monospace;
    font-size: 12px;
    background: #f1f1f1;
    padding: 2px 6px;
    border-radius: 3px;
}

/* Password Strength */
.password-strength {
    margin-top: 4px;
    font-size: 12px;
    height: 20px;
}

.password-strength.weak { color: #dc3545; }
.password-strength.medium { color: #ffc107; }
.password-strength.strong { color: #28a745; }

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    justify-content: center;
}

.page-info {
    font-size: 13px;
    color: #888;
}

/* Search Form */
.search-form .form-inline {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-form input {
    flex: 1;
    max-width: 300px;
}

/* Auth Pages (login, register) */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #1a1a2e;
}

.auth-card {
    background: #fff;
    border-radius: 8px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 24px;
    color: #1a1a2e;
}

.auth-links {
    margin-top: 16px;
    text-align: center;
    font-size: 13px;
}

.auth-links a {
    color: #1a1a2e;
    text-decoration: none;
    margin: 0 8px;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    height: 22px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    vertical-align: middle;
    line-height: 1;
}

.badge-super-admin {
    background: #6f42c1;
    color: #fff;
    margin-left: 4px;
}

.badge-app {
    background: #1a3a2a;
    color: #4ade80;
}

.badge-service {
    background: #1a2a3a;
    color: #60a5fa;
}

/* Edit modal / inline edit */
.edit-row {
    background: #f0f4ff;
}

.edit-row td {
    padding: 8px 12px;
}

.edit-row input,
.edit-row select {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    height: 32px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.edit-row select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23555' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-color: #fff;
    padding-right: 28px;
    cursor: pointer;
}

.edit-row .btn {
    height: 32px;
    padding: 4px 10px;
    font-size: 13px;
}

/* Ecosystem Hub */
.hub-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.hub-card {
    display: block;
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s, transform 0.15s;
    border: 1px solid #eee;
}

.hub-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.hub-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.hub-icon {
    font-size: 28px;
    line-height: 1;
}

.hub-health {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ddd;
    flex-shrink: 0;
}

.hub-health-ok {
    background: #28a745;
    box-shadow: 0 0 6px rgba(40, 167, 69, 0.4);
}

.hub-health-down {
    background: #dc3545;
    box-shadow: 0 0 6px rgba(220, 53, 69, 0.4);
}

.hub-health-unknown {
    background: #ffc107;
}

.hub-card-body h3 {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 4px 0;
}

.hub-domain {
    font-size: 12px;
    color: #888;
}

/* Site name labels */
.site-name-label {
    font-weight: 500;
    color: #1a1a2e;
}

/* Admin chips */
.admin-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 10px 16px;
    min-width: 200px;
}

.admin-chip-icon {
    font-size: 18px;
    color: #6f42c1;
    flex-shrink: 0;
}

.admin-chip-info {
    display: flex;
    flex-direction: column;
}

.admin-chip-name {
    font-weight: 600;
    font-size: 14px;
    color: #1a1a2e;
}

.admin-chip-email {
    font-size: 12px;
    color: #888;
}

/* Role badges */
.badge-role-owner {
    background: #6f42c1;
    color: #fff;
}

.badge-role-admin {
    background: #0d6efd;
    color: #fff;
}

.badge-role-editor {
    background: #198754;
    color: #fff;
}

.badge-role-viewer {
    background: #6c757d;
    color: #fff;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.tab-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    text-decoration: none;
    color: #888;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.tab-link:hover {
    color: #1a1a2e;
}

.tab-link.active {
    color: #1a1a2e;
    border-bottom-color: #1a1a2e;
    font-weight: 600;
}

.tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #e9ecef;
    color: #555;
    font-size: 11px;
    font-weight: 600;
}

.tab-link.active .tab-count {
    background: #1a1a2e;
    color: #fff;
}

/* Site role badges (inline) */
.site-role-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* OAuth badge */
.badge-oauth {
    background: #e3f2fd;
    color: #1565c0;
    text-transform: capitalize;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: static;
        width: 100%;
    }

    .layout {
        flex-direction: column;
    }

    .content {
        margin-left: 0;
        padding: 16px;
    }

    .inline-form {
        flex-direction: column;
    }

    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}
