/* ============================================
   PLATFORM ADMIN STYLES
   ============================================ */

/* Base input field styling to match app design */
.input-field {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary, #fff);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-color, #1E3A5F);
    box-shadow: 0 0 0 3px rgba(107, 138, 94, 0.15);
}

.input-field::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

/* Admin add rows (domain, email, org inputs) */
.admin-add-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.admin-add-row .input-field {
    flex: 1;
}

/* Select dropdowns matching input style */
select.input-field {
    cursor: pointer;
    appearance: auto;
}

/* Textarea matching input style */
textarea.input-field {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

/* Platform Admin Modal Header */
.platform-admin-header {
    background: var(--primary-color);
    color: white;
    border-bottom: none;
}

.platform-admin-header h3 {
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.platform-admin-header .icon {
    width: 28px;
    height: 28px;
}

.platform-admin-subtitle {
    margin: 8px 0 0 0;
    font-size: 0.9rem;
    opacity: 0.95;
    font-weight: normal;
}

.platform-admin-header .btn-close {
    color: white;
    opacity: 0.9;
}

.platform-admin-header .btn-close:hover {
    opacity: 1;
}

/* Platform Stats Grid */
.platform-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.platform-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
}

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

.platform-stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-card);
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.platform-stat-card .stat-icon svg {
    width: 24px;
    height: 24px;
    stroke: white;
}

.platform-stat-card .stat-content {
    flex: 1;
}

.platform-stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 6px;
}

.platform-stat-card .stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.platform-stat-card .stat-change {
    font-size: 0.75rem;
    margin-top: 4px;
    font-weight: 500;
}

.platform-stat-card .stat-change.positive,
.platform-stat-card .stat-change.negative {
    color: var(--text-muted);
}

/* Organization List Items */
.org-item {
    border-left: 4px solid transparent;
    transition: border-color 0.2s ease;
}

.org-item:hover {
    border-left-color: var(--accent-color);
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-card);
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
}

/* A neutral chip that says its state in the word. */
.status-badge.status-active {
    background: var(--bg-input);
    color: var(--text-primary);
}

.status-badge.status-inactive {
    background: var(--bg-input);
    color: var(--text-muted);
}

.status-badge.status-warning {
    background: var(--bg-input);
    color: var(--error-color);
}

/* Impersonation Pill */
.impersonation-pill {
    position: fixed;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--warning-color);
    color: white;
    padding: 4px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    white-space: nowrap;
}

.impersonation-pill .icon {
    width: 14px;
    height: 14px;
}

.impersonation-pill button {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 0 0 0 4px;
    line-height: 1;
    opacity: 0.8;
}

.impersonation-pill button:hover {
    opacity: 1;
}

/* Chart Container */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-top: 12px;
}

.chart-container canvas {
    width: 100% !important;
    max-height: 300px !important;
}

/* Section Header (for Organizations tab) */
.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-header > div {
    flex: 1;
}

/* Audit Log Items */
.audit-item {
    border-left: 3px solid var(--accent-color);
}

.audit-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    margin-right: 12px;
}

/* Action Text Styling */
.action-text {
    color: var(--text-secondary);
    font-weight: normal;
    margin: 0 4px;
}

/* List Item Badge (for rankings) */
.list-item-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    margin-right: 12px;
}

/* ============================================
   STORAGE METRICS STYLES
   ============================================ */

/* Storage Summary Grid */
.storage-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.storage-summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
}

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

.storage-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-card);
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.storage-icon svg {
    width: 24px;
    height: 24px;
    stroke: white;
}

.storage-icon-orgs {
    background: var(--primary-color);
}

.storage-icon-tables {
    background: var(--primary-light);
}

.storage-info {
    flex: 1;
}

.storage-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 6px;
}

.storage-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Storage Tables */
.storage-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 12px;
}

.storage-table {
    width: 100%;
    border-collapse: collapse;
}

.storage-table th,
.storage-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

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

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

.storage-table tr:hover td {
    background: var(--bg-hover);
}

.storage-table code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.875rem;
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
}

.empty-cell {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 24px !important;
}

/* Organization Name Cell */
.org-name-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.org-name {
    font-weight: 600;
    color: var(--text-primary);
}

.org-slug {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* Storage Progress Bar */
.storage-bar-container {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 150px;
}

.storage-bar {
    height: 8px;
    background: var(--primary-color);
    border-radius: 4px;
    min-width: 4px;
    transition: width 0.3s ease;
}

.storage-bar-table {
    background: var(--primary-light);
}

.storage-percentage {
    font-size: 0.875rem;
    color: var(--text-secondary);
    min-width: 50px;
    text-align: right;
}

/* ============================================
   ORG SETUP WIZARD
   ============================================ */

/* Modal override for wizard — wider */
.wizard-modal-content {
    max-width: 720px;
    width: 95vw;
}

/* Step indicators bar */
.wizard-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary, #F5F7FA);
}

.wizard-step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 8px;
    transition: background 0.2s;
    min-width: 64px;
}

.wizard-step-indicator:hover {
    background: rgba(107, 138, 94, 0.08);
}

.wizard-step-indicator .step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    border: 2px solid var(--border-color);
    color: var(--text-muted);
    background: var(--bg-card, #fff);
    transition: all 0.2s;
}

.wizard-step-indicator .step-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.2s;
}

.wizard-step-indicator.active .step-num {
    background: var(--primary-color, #1E3A5F);
    border-color: var(--primary-color, #1E3A5F);
    color: white;
}

.wizard-step-indicator.active .step-label {
    color: var(--text-primary);
    font-weight: 600;
}

.wizard-step-indicator.completed .step-num {
    background: var(--primary-color, #1E3A5F);
    border-color: var(--primary-color, #1E3A5F);
    color: white;
    opacity: 0.7;
}

.wizard-step-indicator.completed .step-label {
    color: var(--text-secondary);
}

/* Wizard body */
.wizard-body {
    padding: 24px;
    min-height: 320px;
    max-height: 55vh;
    overflow-y: auto;
}

.wizard-body h3 {
    margin: 0 0 4px 0;
    font-size: 1.15rem;
    color: var(--text-primary);
}

.wizard-help {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0 0 16px 0;
    line-height: 1.4;
}

.wizard-error {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--error-color);
    padding: 8px 12px;
    border-radius: var(--radius-control);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.wizard-success {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 16px;
    border-radius: var(--radius-control);
    font-size: 0.9rem;
    text-align: center;
}

/* Form fields */
.wizard-field {
    margin-bottom: 16px;
}

.wizard-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.wizard-field label .required {
    color: var(--error-color);
}

.wizard-field input[type="text"],
.wizard-field input[type="email"],
.wizard-field input[type="password"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--bg-primary, #fff);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.wizard-field input:focus {
    outline: none;
    border-color: var(--primary-color, #1E3A5F);
    box-shadow: 0 0 0 3px rgba(107, 138, 94, 0.15);
}

.field-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.field-muted {
    opacity: 0.6;
    background: var(--bg-secondary, #F5F7FA) !important;
}

/* Inline field rows (zones, subfolders) */
.wizard-field-inline {
    flex: 1;
    min-width: 0;
}

.wizard-field-inline label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.wizard-field-inline input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-primary);
    background: var(--bg-primary, #fff);
    box-sizing: border-box;
}

.wizard-field-inline input:focus {
    outline: none;
    border-color: var(--primary-color, #1E3A5F);
    box-shadow: 0 0 0 2px rgba(107, 138, 94, 0.12);
}

/* Provider card grid */
.provider-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.provider-card {
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    background: var(--bg-card, #fff);
}

.provider-card:hover {
    border-color: var(--primary-color, #1E3A5F);
    box-shadow: 0 2px 8px rgba(107, 138, 94, 0.12);
}

.provider-card.selected {
    border-color: var(--primary-color, #1E3A5F);
    background: rgba(107, 138, 94, 0.06);
    box-shadow: 0 0 0 3px rgba(107, 138, 94, 0.15);
}

.provider-icon {
    font-size: 2rem;
    margin-bottom: 6px;
}

.provider-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.provider-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Config section (credentials after provider selection) */
.wizard-config-section {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    margin-top: 4px;
}

.wizard-config-section h4 {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* Test connection results */
.testing {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-left: 8px;
}

.test-pass {
    color: var(--success-dark);
    font-size: 0.85rem;
    font-weight: 500;
    margin-left: 8px;
}

.test-fail {
    color: var(--error-color);
    font-size: 0.85rem;
    font-weight: 500;
    margin-left: 8px;
}

/* Strategy radio options */
.strategy-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.strategy-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-card, #fff);
}

.strategy-option:hover {
    border-color: var(--primary-color, #1E3A5F);
}

.strategy-option.selected {
    border-color: var(--primary-color, #1E3A5F);
    background: rgba(107, 138, 94, 0.06);
}

.strategy-option input[type="radio"] {
    accent-color: var(--primary-color, #1E3A5F);
    flex-shrink: 0;
}

.strategy-content {
    flex: 1;
}

.strategy-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.strategy-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 1px;
}

/* Zones config */
.zones-config {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.zones-config h4 {
    margin: 0 0 4px 0;
    font-size: 0.9rem;
}

.zone-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 8px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card, #fff);
}

.zone-states-field {
    flex: 2;
}

/* Subfolder rows */
.subfolder-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card, #fff);
}

.add-subfolder-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
    margin-bottom: 20px;
}

.add-subfolder-row input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-primary);
    background: var(--bg-primary, #fff);
    box-sizing: border-box;
}

/* Path preview / tree preview */
.path-preview {
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--bg-secondary, #F5F7FA);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.path-preview h4 {
    margin: 0 0 8px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.preview-path {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.preview-tree {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin: 0;
    white-space: pre;
}

/* Folder browser */
.folder-browser {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 12px;
}

.browser-breadcrumb {
    padding: 8px 12px;
    background: var(--bg-secondary, #F5F7FA);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
}

.crumb-link {
    color: var(--primary-color, #1E3A5F);
    cursor: pointer;
    text-decoration: none;
}

.crumb-link:hover {
    text-decoration: underline;
}

.crumb-current {
    font-weight: 600;
    color: var(--text-primary);
}

.browser-items {
    max-height: 240px;
    overflow-y: auto;
    padding: 8px;
}

.manual-folder-input {
    padding: 8px;
}

.loading-state, .empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 24px;
    font-size: 0.85rem;
}

/* Selected folder banner */
.selected-folder {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(107, 138, 94, 0.08);
    border: 1px solid rgba(107, 138, 94, 0.25);
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--text-primary);
}

/* Wizard folder browser items */
.wiz-folder-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.wiz-folder-item:hover {
    background: var(--bg-secondary, #F5F7FA);
}

.wiz-folder-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.wiz-folder-name {
    flex: 1;
    cursor: pointer;
    color: var(--primary-color, #1E3A5F);
}

.wiz-folder-name:hover {
    text-decoration: underline;
}

.wiz-folder-item .btn-sm {
    flex-shrink: 0;
    font-size: 0.75rem;
    padding: 2px 8px;
}

/* Review sections */
.review-section {
    margin-bottom: 16px;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card, #fff);
}

.review-section h4 {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
}

.review-row {
    display: flex;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 3px 0;
}

.review-row span {
    min-width: 100px;
    flex-shrink: 0;
}

.review-row code {
    font-family: 'Consolas', 'Monaco', monospace;
    background: var(--bg-secondary, #F5F7FA);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.82rem;
}

/* Wizard footer */
.wizard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary, #F5F7FA);
}

.wizard-footer-right {
    display: flex;
    gap: 8px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .platform-stats-grid {
        grid-template-columns: 1fr;
    }

    .storage-summary-grid {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        gap: 16px;
    }

    .impersonation-pill {
        font-size: 11px;
        padding: 3px 10px;
    }

    .storage-table-container {
        overflow-x: auto;
    }

    .storage-bar-container {
        min-width: 100px;
    }

    /* Wizard mobile */
    .wizard-steps {
        gap: 2px;
        padding: 12px 8px;
    }

    .wizard-step-indicator {
        padding: 4px 6px;
        min-width: 44px;
    }

    .wizard-step-indicator .step-label {
        font-size: 0.6rem;
    }

    .wizard-body {
        padding: 16px;
    }

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

    .zone-row,
    .subfolder-row {
        flex-wrap: wrap;
    }

    .wizard-footer {
        padding: 12px 16px;
    }
}
