/* ============================================
   SPOC WebComment - Admin Interface Styles
   ============================================ */

:root {
    --primary: #e40521;
    --primary-dark: #c00419;
    --primary-light: #ff2d45;
    --bg: #f5f6f8;
    --bg-white: #ffffff;
    --text: #1a1a2e;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --border-focus: #e40521;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
    --radius: 8px;
    --radius-sm: 4px;
    --transition: 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ---- Navbar ---- */
.navbar {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
}

.nav-logo {
    height: 40px;
    width: auto;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: all var(--transition);
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
    background: rgba(228, 5, 33, 0.06);
}

.nav-user {
    color: var(--text);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0 8px;
}

.nav-logout {
    color: var(--text-muted);
}

/* ---- 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: 16px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.breadcrumb {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    margin-bottom: 4px;
    display: inline-block;
}

.breadcrumb:hover {
    color: var(--primary);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-white);
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
}

.btn:hover {
    border-color: var(--text-muted);
    box-shadow: var(--shadow);
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-danger {
    color: var(--danger);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

.btn-warning {
    color: var(--warning);
    border-color: var(--warning);
}

.btn-warning:hover {
    background: var(--warning);
    color: white;
}

.btn-success {
    color: var(--success);
    border-color: var(--success);
}

.btn-success:hover {
    background: var(--success);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

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

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    transition: border-color var(--transition);
    background: var(--bg-white);
    color: var(--text);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(228, 5, 33, 0.1);
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.select-sm {
    padding: 4px 8px;
    font-size: 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
}

.inline-form {
    display: inline-flex;
}

/* ---- Alerts ---- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ---- Badges ---- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.badge-active { background: #ecfdf5; color: #065f46; }
.badge-inactive { background: #f3f4f6; color: #6b7280; }
.badge-guest { background: #eff6ff; color: #1e40af; }
.badge-resolved { background: #ecfdf5; color: #065f46; }

/* ---- Project Cards ---- */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 20px;
}

.project-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow var(--transition);
}

.project-card:hover {
    box-shadow: var(--shadow-lg);
}

.project-card.inactive {
    opacity: 0.65;
}

.project-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 0;
}

.project-card-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.project-card-body {
    padding: 12px 20px 16px;
}

.project-url {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 12px;
}

.project-stats {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.invite-link-group {
    margin-top: 8px;
}

.invite-link-group label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: block;
}

.input-copy-group {
    display: flex;
    gap: 6px;
}

.input-copy-group input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg);
}

.project-card-actions {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg);
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ---- Tables ---- */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.data-table th {
    background: var(--bg);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

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

.data-table tr:hover td {
    background: rgba(228, 5, 33, 0.02);
}

.data-table tr.row-inactive td {
    opacity: 0.5;
}

.actions-cell {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ---- Comments List (Admin) ---- */
.comment-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment-item {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    transition: box-shadow var(--transition);
}

.comment-item:hover {
    box-shadow: var(--shadow);
}

.comment-item.resolved {
    opacity: 0.6;
    border-left: 3px solid var(--success);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 6px;
}

.comment-header strong {
    margin-right: 6px;
}

.comment-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.comment-body p {
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.comment-meta {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.comment-actions {
    margin-top: 12px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Comment number badge */
.comment-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    margin-right: 8px;
    flex-shrink: 0;
}

/* ---- Comment Replies (Admin view) ---- */
.comment-replies {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.replies-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.reply-item {
    margin-left: 20px;
    padding-left: 12px;
    border-left: 2px solid var(--border);
    margin-bottom: 10px;
}

.reply-header {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.reply-header strong {
    font-size: 0.85rem;
}

.reply-text {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.5;
}

/* ---- Modal ---- */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 28px;
    width: 90%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    z-index: 1;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 1.15rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    line-height: 1;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ---- Login Page ---- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f6f8 0%, #fff 100%);
}

.login-container {
    background: var(--bg-white);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 400px;
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo img {
    height: 56px;
}

.login-container h1 {
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: 24px;
    color: var(--text);
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.empty-state h2 {
    font-size: 1.2rem;
    color: var(--text);
    margin-bottom: 8px;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .navbar {
        padding: 0 12px;
        height: auto;
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
    }

    .nav-links {
        gap: 4px;
        flex-wrap: wrap;
    }

    .container {
        padding: 16px;
    }

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

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .actions-cell {
        flex-direction: column;
    }

    .project-card-actions {
        flex-direction: column;
    }
}
