/* Clarus - Web Interface Styles */

:root {
    /* Risk colors matching PDF reports */
    --risk-high: #e63333;
    --risk-high-bg: #ffe6e6;
    --risk-medium: #ff9900;
    --risk-medium-bg: #fff5e6;
    --risk-low: #e6cc00;
    --risk-low-bg: #ffffe6;
    --risk-compliant: #33b333;
    --risk-compliant-bg: #e6ffe6;
    --risk-error: #808080;
    --risk-error-bg: #f2f2f2;

    /* General colors */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --text: #1f2937;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --background: #f9fafb;
    --white: #ffffff;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

header .logo {
    width: 180px;
    height: auto;
    margin-bottom: 1rem;
    display: block;
}

.logo-link {
    display: inline-flex;
    line-height: 0;
    flex-shrink: 0;
}

header .subtitle {
    color: var(--text-light);
    font-size: 1rem;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.5;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin: 0.5rem 0 1rem;
    text-align: center;
}

.warning-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    padding: 14px 18px;
    margin-top: 20px;
    font-size: 0.9em;
    color: #856404;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
}

.warning-icon {
    font-size: 1.4em;
    line-height: 1;
    flex-shrink: 0;
}

.warning-content {
    flex: 1;
    line-height: 1.5;
}

/* Panel prompt */
.panel-prompt {
    text-align: center;
    color: var(--text);
    font-size: 1rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* Main content */
main {
    flex: 1;
}

section {
    background: var(--white);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Dropzone */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--primary);
    background-color: #f0f5ff;
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-icon {
    color: var(--text-light);
}

.dropzone-text {
    font-size: 1.1rem;
    font-weight: 500;
}

.dropzone-hint {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* File info */
.file-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    margin-top: 1rem;
    background: var(--background);
    border-radius: 8px;
}

.file-name {
    font-weight: 500;
}

.remove-file {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0 0.25rem;
}

.remove-file:hover {
    color: var(--risk-high);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #28a745;
    color: white;
    width: 100%;
    margin-top: 1.5rem;
}

.btn-primary:hover:not(:disabled) {
    background: #218838;
}

.btn-secondary {
    background: var(--text);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #374151;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover:not(:disabled) {
    background: var(--background);
}

/* Progress */
.progress-container {
    text-align: center;
    padding: 3rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.progress-text {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.progress-hint {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Results */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-header h2 {
    font-size: 1.5rem;
}

.results-actions {
    display: flex;
    gap: 0.75rem;
}

/* Risk Badge */
.risk-badge-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.risk-badge {
    padding: 1rem 2rem;
    border-radius: 8px;
    text-align: center;
}

.risk-badge .risk-level {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

.risk-badge.risk-high {
    background: var(--risk-high);
}

.risk-badge.risk-medium {
    background: var(--risk-medium);
}

.risk-badge.risk-low {
    background: var(--risk-low);
    color: #333;
}

.risk-badge.risk-low .risk-level {
    color: #333;
}

.risk-badge.risk-compliant {
    background: var(--risk-compliant);
}

.risk-badge.risk-error,
.risk-badge.risk-unknown {
    background: var(--risk-error);
}

/* Severity class aliases for style reviews */
.risk-badge.risk-critical {
    background: var(--risk-high);
}

.risk-badge.risk-major {
    background: var(--risk-medium);
}

.risk-badge.risk-minor {
    background: var(--risk-low);
    color: #333;
}

.risk-badge.risk-minor .risk-level {
    color: #333;
}

.document-info p {
    margin: 0.25rem 0;
    color: var(--text-light);
}

/* Summary box */
.summary-box {
    background: var(--background);
    padding: 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.summary-box h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.summary-box p {
    color: var(--text);
}

/* Issue counts */
.issue-counts {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.count-item {
    flex: 1;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.count-item.high {
    background: var(--risk-high-bg);
    border-left: 4px solid var(--risk-high);
}

.count-item.medium {
    background: var(--risk-medium-bg);
    border-left: 4px solid var(--risk-medium);
}

.count-item.low {
    background: var(--risk-low-bg);
    border-left: 4px solid var(--risk-low);
}

.count-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
}

.count-item.high .count-number { color: var(--risk-high); }
.count-item.medium .count-number { color: var(--risk-medium); }
.count-item.low .count-number { color: var(--risk-low); }

.count-label {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Issues list */
.issues-container h3,
.missing-container h3,
.compliant-notes-container h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.issues-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.no-issues {
    text-align: center;
    color: var(--risk-compliant);
    padding: 2rem;
    background: var(--risk-compliant-bg);
    border-radius: 8px;
}

.issue-item {
    border-radius: 8px;
    overflow: hidden;
}

.issue-item.risk-high {
    border: 1px solid var(--risk-high);
    background: var(--risk-high-bg);
}

.issue-item.risk-medium {
    border: 1px solid var(--risk-medium);
    background: var(--risk-medium-bg);
}

.issue-item.risk-low {
    border: 1px solid var(--risk-low);
    background: var(--risk-low-bg);
}

/* Severity class aliases for style review issue items */
.issue-item.risk-critical {
    border: 1px solid var(--risk-high);
    background: var(--risk-high-bg);
}

.issue-item.risk-major {
    border: 1px solid var(--risk-medium);
    background: var(--risk-medium-bg);
}

.issue-item.risk-minor {
    border: 1px solid var(--risk-low);
    background: var(--risk-low-bg);
}

.issue-header {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    gap: 0.75rem;
}

.issue-header:hover {
    opacity: 0.9;
}

.issue-number {
    font-weight: 600;
    color: var(--text-light);
}

.issue-clauses {
    flex: 1;
    font-weight: 500;
}

.issue-risk-tag {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.risk-high .issue-risk-tag {
    background: var(--risk-high);
    color: white;
}

.risk-medium .issue-risk-tag {
    background: var(--risk-medium);
    color: white;
}

.risk-low .issue-risk-tag {
    background: var(--risk-low);
    color: #333;
}

/* Severity class aliases for risk tags */
.risk-critical .issue-risk-tag {
    background: var(--risk-high);
    color: white;
}

.risk-major .issue-risk-tag {
    background: var(--risk-medium);
    color: white;
}

.risk-minor .issue-risk-tag {
    background: var(--risk-low);
    color: #333;
}

.issue-toggle {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--text-light);
    width: 24px;
    text-align: center;
}

.issue-details {
    padding: 1rem;
    background: white;
    border-top: 1px solid var(--border);
}

.detail-row {
    margin-bottom: 0.75rem;
}

.detail-row:last-child {
    margin-bottom: 0;
}

.detail-row label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.flagged-text {
    font-style: italic;
    background: #fffbeb;
    padding: 0.5rem;
    border-radius: 4px;
    border-left: 3px solid var(--risk-low);
}

/* Missing elements */
.missing-container {
    margin-top: 1.5rem;
}

.missing-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.missing-item {
    padding: 0.75rem 1rem;
    border-radius: 8px;
}

.missing-item.risk-high {
    background: var(--risk-high-bg);
    border-left: 4px solid var(--risk-high);
}

.missing-item.risk-medium {
    background: var(--risk-medium-bg);
    border-left: 4px solid var(--risk-medium);
}

.missing-item.risk-low {
    background: var(--risk-low-bg);
    border-left: 4px solid var(--risk-low);
}

/* Severity class aliases for missing items */
.missing-item.risk-critical {
    background: var(--risk-high-bg);
    border-left: 4px solid var(--risk-high);
}

.missing-item.risk-major {
    background: var(--risk-medium-bg);
    border-left: 4px solid var(--risk-medium);
}

.missing-item.risk-minor {
    background: var(--risk-low-bg);
    border-left: 4px solid var(--risk-low);
}

.missing-item .clause-tag {
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.1);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    margin-left: 0.5rem;
}

.missing-item p {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

/* Compliant notes */
.compliant-notes-container {
    margin-top: 1.5rem;
    background: var(--risk-compliant-bg);
    padding: 1.25rem;
    border-radius: 8px;
    border-left: 4px solid var(--risk-compliant);
}

.compliant-notes-container h3 {
    color: var(--risk-compliant);
}

/* Error */
.error-box {
    text-align: center;
    padding: 2rem;
}

.error-box h3 {
    color: var(--risk-high);
    margin-bottom: 1rem;
}

.error-box p {
    margin-bottom: 1.5rem;
    color: var(--text-light);
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0 1rem;
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Framework selector */
.framework-selector {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--background);
    border-radius: 8px;
    text-align: center;
}

.framework-selector label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.framework-selector select {
    width: 100%;
    max-width: 400px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--white);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
}

.framework-selector select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.framework-hint {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Tab Navigation */
.tab-container {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
}

.tab {
    flex: 1;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-light);
    margin-bottom: -2px;
}

.tab:hover {
    color: var(--text);
    background: var(--background);
}

.tab.active {
    color: #21a9e2;
    border-bottom-color: #21a9e2;
    background: transparent;
}

/* Panels */
.panel {
    display: none;
}

.panel.active {
    display: block;
}

/* Coming Soon Section */
.coming-soon-section {
    background: var(--white);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.coming-soon {
    text-align: center;
    padding: 60px 20px;
}

.coming-soon-icon {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.coming-soon h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
}

.coming-soon-badge {
    display: inline-block;
    background: #f0ad4e;
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1.5rem;
}

.coming-soon-description {
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.coming-soon-details {
    color: var(--text-light);
    max-width: 500px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

.coming-soon-features {
    background: var(--background);
    padding: 1.5rem 2rem;
    border-radius: 12px;
    display: inline-block;
    text-align: left;
    margin-top: 1rem;
}

.coming-soon-features h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.coming-soon-features ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.coming-soon-features li {
    padding: 0.5rem 0;
    color: var(--text-light);
    position: relative;
    padding-left: 1.5rem;
}

.coming-soon-features li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0.5;
}

/* Style Guide Reference Panel */
.reference-section {
    background: var(--white);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.reference-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

#rule-search {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--white);
}

#rule-search:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.filter-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--text-light);
    pointer-events: none;
    z-index: 1;
}

#category-filter {
    min-width: 180px;
    padding: 0.75rem 1rem 0.75rem 2.25rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--white);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
}

#category-filter:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#reset-filters-btn.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--white);
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s ease;
}

#reset-filters-btn.btn-icon:hover {
    background: var(--background);
    color: var(--text);
    border-color: var(--text-light);
}

/* Rules List */
.rules-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.rules-loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.rules-loading .spinner {
    margin-bottom: 1rem;
}

.rules-error {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

.rules-error .btn {
    margin-top: 1rem;
}

.no-rules {
    text-align: center;
    color: var(--text-light);
    padding: 2rem;
    background: var(--background);
    border-radius: 8px;
}

/* Rule Item */
.rule-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--white);
}

.rule-header {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    gap: 0.75rem;
    background: var(--background);
    transition: background 0.2s ease;
}

.rule-header:hover {
    background: #e8eaed;
}

.rule-id {
    font-weight: 600;
    color: #21a9e2;
    white-space: nowrap;
}

.rule-title {
    flex: 1;
    font-weight: 500;
}

.category-tag {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: #21a9e2;
    color: white;
    white-space: nowrap;
}

.rule-toggle {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--text-light);
    width: 24px;
    text-align: center;
}

.rule-details {
    padding: 1rem;
    border-top: 1px solid var(--border);
    background: var(--white);
}

.rule-summary,
.rule-full-text,
.rule-watch-for {
    margin-bottom: 1rem;
}

.rule-summary:last-child,
.rule-full-text:last-child,
.rule-watch-for:last-child {
    margin-bottom: 0;
}

.rule-details label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.rule-details p {
    color: var(--text);
    line-height: 1.6;
    white-space: pre-wrap;
}

.rule-watch-for ul {
    list-style: disc;
    padding-left: 1.25rem;
    margin: 0;
}

.rule-watch-for li {
    margin: 0.25rem 0;
    color: var(--text);
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    section {
        padding: 1.5rem;
    }

    .results-header {
        flex-direction: column;
        align-items: stretch;
    }

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

    .issue-counts {
        flex-direction: column;
    }

    .risk-badge-container {
        flex-direction: column;
        text-align: center;
    }

    .tab-container {
        flex-direction: column;
    }

    .tab {
        border-bottom: none;
        border-left: 3px solid transparent;
        text-align: left;
    }

    .tab.active {
        border-bottom: none;
        border-left-color: #21a9e2;
    }

    .coming-soon {
        padding: 40px 15px;
    }

    .coming-soon-features {
        padding: 1rem 1.5rem;
    }

    /* Reference panel responsive */
    .reference-controls {
        flex-direction: column;
    }

    #category-filter {
        min-width: 100%;
    }

    .rule-header {
        flex-wrap: wrap;
    }

    .rule-id {
        width: 100%;
        margin-bottom: 0.25rem;
    }

    .category-tag {
        order: 3;
        margin-top: 0.5rem;
    }
}

/* ============================================
   Login Page Styles
   ============================================ */

.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--background);
}

.login-card {
    background: var(--white);
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    max-width: 150px;
    height: auto;
}

.login-form h2 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.login-subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.login-loading {
    text-align: center;
    padding: 2rem;
}

.login-loading .spinner {
    margin-bottom: 1rem;
}

.login-error {
    background: var(--risk-high-bg);
    color: var(--risk-high);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    border-left: 4px solid var(--risk-high);
}

.form-group {
    margin-bottom: 1.25rem;
}

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

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--white);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input::placeholder {
    color: var(--text-light);
}

.login-form .btn-primary {
    margin-top: 0.5rem;
}

.login-footer {
    margin-top: 2rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.875rem;
}

/* ============================================
   Header User Controls
   ============================================ */

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.header-left,
.header-right {
    flex: 1;
}

.header-right {
    display: flex;
    justify-content: flex-end;
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 400;
    font-family: inherit;
    line-height: 1.25;
    box-sizing: border-box;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text);
    text-decoration: none;
}

.btn-logout:hover {
    background: var(--background);
    border-color: var(--text-light);
}

/* ============================================
   Admin Panel Styles
   ============================================ */

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.admin-header-left,
.admin-header-center,
.admin-header-right {
    flex: 1;
}

.admin-header-left {
    display: flex;
    justify-content: flex-start;
}

.admin-header-center {
    text-align: center;
}


.admin-header-right {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--text);
}

.user-badge {
    font-weight: 500;
    color: var(--text);
    background: var(--background);
    padding: 0.5rem 1rem;
    border-radius: 6px;
}

.admin-main {
    flex: 1;
}

.admin-section {
    background: var(--white);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.section-header .btn-primary {
    width: auto;
    margin-top: 0;
}

.admin-loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.admin-error {
    background: var(--risk-high-bg);
    color: var(--risk-high);
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid var(--risk-high);
}

/* Users Table */
.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th,
.users-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.users-table th {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.users-table tbody tr:hover {
    background: var(--background);
}

.user-name {
    font-weight: 500;
}

.you-badge {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: normal;
}

.role-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.role-admin {
    background: #dbeafe;
    color: #1d4ed8;
}

.role-user {
    background: #f3f4f6;
    color: #6b7280;
}

.actions-cell {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--border);
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--background);
    color: var(--text);
    border-color: var(--text-light);
}

.btn-icon.btn-danger {
    background: transparent;
    color: var(--risk-high);
}

.btn-icon.btn-danger:hover {
    background: transparent;
    border-color: var(--risk-high);
}

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

.btn-danger:not(.btn-icon):hover:not(:disabled) {
    background: #c62828;
}

.no-users {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

/* ============================================
   Modal Styles
   ============================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    width: 100%;
    max-width: 450px;
    margin: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-small {
    max-width: 350px;
}

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

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

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

.modal-close:hover {
    color: var(--text);
}

.modal-info {
    margin-bottom: 1.5rem;
    color: var(--text-light);
}

.modal-warning {
    color: var(--risk-high);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.form-error {
    background: var(--risk-high-bg);
    color: var(--risk-high);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    font-size: 0.9rem;
    border-left: 4px solid var(--risk-high);
}

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Style Options Section */
.style-options {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--background);
    border-radius: 8px;
    border-left: 4px solid #21a9e2;
}

.style-options .checkbox-label {
    font-weight: 500;
    color: var(--text);
}

.style-options .checkbox-label span {
    margin-left: 0.25rem;
}

.style-options .option-hint {
    margin: 0.5rem 0 0 1.75rem;
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.4;
}

/* ============================================
   Success Message Styles
   ============================================ */

.form-success {
    background: var(--risk-compliant-bg);
    color: var(--risk-compliant);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    font-size: 0.9rem;
    border-left: 4px solid var(--risk-compliant);
}

/* ============================================
   My Account Modal Styles
   ============================================ */

.account-info-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.account-info-section h4,
.change-password-section h4 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.account-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.account-info-item {
    background: var(--background);
    padding: 0.75rem 1rem;
    border-radius: 8px;
}

.account-info-item label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.account-info-item span {
    display: block;
    color: var(--text);
    font-weight: 500;
}

.change-password-section .btn-primary {
    margin-top: 1rem;
}

/* ============================================
   Audit Log Styles
   ============================================ */

.audit-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.audit-controls select {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--white);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 0.875rem;
}

.audit-list {
    overflow-x: auto;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.audit-table th,
.audit-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.audit-table th {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--background);
}

.audit-table tbody tr:hover {
    background: var(--background);
}

.action-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.action-badge.action-user_created {
    background: #dbeafe;
    color: #1d4ed8;
}

.action-badge.action-user_deleted {
    background: var(--risk-high-bg);
    color: var(--risk-high);
}

.action-badge.action-password_reset_by_admin,
.action-badge.action-password_changed_self {
    background: var(--risk-medium-bg);
    color: var(--risk-medium);
}

.action-badge.action-account_locked {
    background: var(--risk-high-bg);
    color: var(--risk-high);
}

.details-cell {
    color: var(--text-light);
    font-size: 0.8rem;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.no-events {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

/* ============================================
   API Usage Styles
   ============================================ */

.usage-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.usage-card {
    background: var(--background);
    padding: 1.25rem;
    border-radius: 8px;
    text-align: center;
    border-left: 4px solid var(--primary);
}

.usage-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.usage-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.usage-list {
    overflow-x: auto;
}

.usage-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.usage-table th,
.usage-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.usage-table th {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--background);
}

.usage-table tbody tr:hover {
    background: var(--background);
}

.token-cell {
    text-align: right;
    font-family: monospace;
    color: var(--text-light);
}

.cost-cell {
    text-align: right;
    font-family: monospace;
    font-weight: 600;
    color: var(--risk-compliant);
}

.framework-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.framework-badge.framework-abpi_uk {
    background: #dbeafe;
    color: #1d4ed8;
}

.framework-badge.framework-medicines_australia {
    background: #dcfce7;
    color: #166534;
}

.framework-badge.framework-edge_style_guide {
    background: #fef3c7;
    color: #92400e;
}

@media (max-width: 640px) {
    .usage-summary {
        grid-template-columns: 1fr;
    }

    .usage-table {
        font-size: 0.8rem;
    }

    .usage-table th,
    .usage-table td {
        padding: 0.5rem;
    }
}

/* ============================================
   Login Lockout Error Styles
   ============================================ */

.login-error-lockout {
    background: var(--risk-high-bg);
    color: var(--risk-high);
    border-left-color: var(--risk-high);
    font-weight: 500;
}

/* ============================================
   Help Button Styles
   ============================================ */

.btn-help {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text);
    text-decoration: none;
}

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

.btn-help svg {
    flex-shrink: 0;
}

/* ============================================
   Help Modal Styles
   ============================================ */

.modal-large {
    max-width: 650px;
    max-height: 85vh;
    overflow-y: auto;
}

.help-content {
    max-height: 65vh;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.help-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.help-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.help-section h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.help-section p {
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.help-section ul,
.help-section ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
    color: var(--text);
}

.help-section li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.help-subsection {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--background);
    border-radius: 8px;
}

.help-subsection h5 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.help-subsection ol {
    margin: 0;
    padding-left: 1.25rem;
}

.help-subsection li {
    margin-bottom: 0.4rem;
}

/* Help Table */
.help-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
}

.help-table th,
.help-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.help-table th {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--background);
}

.help-table td {
    font-size: 0.9rem;
    vertical-align: top;
}

.help-table tbody tr:hover {
    background: var(--background);
}

/* ============================================
   Responsive Admin
   ============================================ */

@media (max-width: 640px) {
    .admin-header {
        flex-direction: column;
        gap: 1rem;
    }

    .admin-header-left,
    .admin-header-center,
    .admin-header-right {
        flex: none;
        width: 100%;
        text-align: center;
    }

    .admin-header-left {
        order: 2;
    }

    .admin-header-center {
        order: 1;
    }

    .admin-header-right {
        order: 3;
        justify-content: center;
    }

    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .users-table {
        font-size: 0.875rem;
    }

    .users-table th,
    .users-table td {
        padding: 0.5rem;
    }

    .modal-content {
        margin: 0.5rem;
        padding: 1rem;
    }

    .header-top {
        flex-direction: column;
        gap: 1rem;
    }

    .header-left,
    .header-right {
        width: 100%;
        justify-content: center;
    }

    .user-controls {
        justify-content: center;
    }
}

/* ============================================
   Dashboard Styles
   ============================================ */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.dashboard-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: var(--white);
    border-radius: 12px;
    padding: 2rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    position: relative;
    border: 2px solid transparent;
}

.dashboard-card-active:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    border-color: var(--primary);
}

.dashboard-card-coming-soon {
    background: var(--background);
    border: 2px dashed var(--border);
    cursor: default;
}

.dashboard-card-coming-soon .dashboard-card-icon {
    color: var(--text-muted);
}

.dashboard-card-coming-soon .dashboard-card-title {
    color: var(--text-muted);
}

.dashboard-card-coming-soon .dashboard-card-description {
    color: var(--text-muted);
}

.coming-soon-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #f0ad4e;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.dashboard-card-icon {
    color: #21a9e2;
    margin-bottom: 1rem;
}

.dashboard-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 0.5rem 0;
}

.dashboard-card-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* Dashboard responsive styles */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .dashboard-card {
        padding: 1.5rem 1rem;
    }

    .dashboard-card-icon svg {
        width: 40px;
        height: 40px;
    }
}
