/*
 * Portal Modern UI - Unified Design System
 * Matches VPN/vEmail purple gradient theme
 */

:root {
    --primary-purple: #3498db;
    --primary-dark: #2c3e50;
    --secondary-blue: #3498db;
    --dark-bg: #2c3e50;
    --light-bg: #f8f9fa;
    --card-bg: #ffffff;
    --text-dark: #2c3e50;
    --text-muted: #7f8c8d;
    --border-color: #e1e8ed;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
}

/* Modern Form Container */
.modern-form-container {
    max-width: 500px;
    margin: 3rem auto;
    padding: 0;
}

.modern-form-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    overflow: hidden;
}

.modern-form-header {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.modern-form-header h2 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
}

.modern-form-header p {
    margin: 0.5rem 0 0 0;
    opacity: 0.95;
    font-size: 0.95rem;
}

.modern-form-body {
    padding: 2rem;
}

.modern-form-group {
    margin-bottom: 1.5rem;
}

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

.modern-form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.modern-form-input:focus {
    outline: none;
    border-color: var(--secondary-blue);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.modern-form-input::placeholder {
    color: #bdc3c7;
}

.modern-form-small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.modern-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.modern-btn-primary {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
}

.modern-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.35);
}

.modern-btn-secondary {
    background: white;
    color: var(--secondary-blue);
    border: 2px solid var(--secondary-blue);
}

.modern-btn-secondary:hover {
    background: var(--secondary-blue);
    color: white;
}

.modern-form-footer {
    padding: 1.5rem 2rem;
    background: var(--light-bg);
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.modern-form-footer p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.modern-form-footer a {
    color: var(--primary-purple);
    text-decoration: none;
    font-weight: 500;
}

.modern-form-footer a:hover {
    text-decoration: underline;
}

/* Modern Dashboard */
.modern-dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.modern-dashboard-header {
    margin-bottom: 2rem;
}

.modern-dashboard-header h2 {
    color: var(--text-dark);
    font-size: 2rem;
    margin: 0 0 0.5rem 0;
}

.modern-dashboard-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin: 0;
}

/* Modern Card Grid */
.modern-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.modern-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.modern-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

/* Portal utility helpers */
.portal-form-group-spaced {
    margin-bottom: 2rem;
}

.portal-form-link {
    color: var(--primary-purple);
    text-decoration: none;
    font-size: 0.9rem;
}

.portal-form-link:hover {
    text-decoration: underline;
}

.portal-form-top {
    margin-top: 1rem;
}

.portal-form-inline-label {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.portal-form-resend {
    margin-top: 1rem;
}

.portal-button-muted {
    opacity: 0.85;
}

.portal-card-wide {
    max-width: 980px;
}

.portal-card-mid {
    max-width: 750px;
}

.portal-card-narrow {
    max-width: 650px;
}

.portal-agreement-box {
    border: 1px solid #d8dbe3;
    border-radius: 10px;
    padding: 16px;
    height: 360px;
    overflow: auto;
    background: #fafbfc;
    line-height: 1.5;
}

.portal-agreement-title {
    margin-top: 0;
}

.portal-agreement-meta {
    color: #667085;
    font-size: 13px;
}

.portal-form-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.portal-form-row label {
    margin: 0;
}

.portal-button-row {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 18px;
}

.portal-link-button {
    text-decoration: none;
    display: inline-block;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid #cfd4df;
}

.portal-button-gap {
    margin-right: 0.5rem;
}

.portal-list-compact {
    margin-top: 0.75rem;
    line-height: 1.6;
}

.portal-text-tight {
    margin-top: 0;
}

.portal-text-muted {
    opacity: 0.85;
}

.portal-form-stack {
    margin-top: 1.25rem;
}

.modern-card h3 {
    color: var(--text-dark);
    margin: 0 0 1rem 0;
    font-size: 1.25rem;
    border-bottom: 2px solid var(--primary-purple);
    padding-bottom: 0.5rem;
}

.modern-card p {
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0.5rem 0;
}

.modern-card p strong {
    color: var(--text-dark);
}

/* Stats Cards */
.modern-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.modern-stat-card {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.modern-stat-card h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 500;
}

.modern-stat-number {
    font-size: 2.25rem;
    font-weight: bold;
    margin: 0.5rem 0;
}

.modern-stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
    margin: 0;
}

/* Highlight Card */
.modern-card-highlight {
    background: linear-gradient(135deg, #ecf8ff 0%, #f0f7ff 100%);
    border: 2px solid var(--primary-purple);
}

/* Action Buttons */
.modern-action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    align-items: center;
}

.modern-action-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-block;
    cursor: pointer;
}

.modern-action-btn-primary {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
}

.modern-action-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.modern-action-btn-secondary {
    background: white;
    color: var(--primary-purple);
    border: 2px solid var(--primary-purple);
}

.modern-action-btn-secondary:hover {
    background: var(--primary-purple);
    color: white;
}

/* vAnalytics: Save button disabled state */
.va-save-disabled {
    opacity: 0.4 !important;
    pointer-events: none !important;
    cursor: default !important;
}

/* Badge Styles */
.modern-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.modern-badge-success {
    background: #d4edda;
    color: #155724;
}

.modern-badge-warning {
    background: #fff3cd;
    color: #856404;
}

.modern-badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

/* Lists */
.modern-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.modern-list li {
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: var(--light-bg);
    border-left: 4px solid var(--primary-purple);
    border-radius: 4px;
}

/* ----------------------------------------------------------
 * vAnalytics response: <textarea readonly>
 * ---------------------------------------------------------- */
.va-output {
    display: block;
    width: 100%;
    box-sizing: border-box;

    /* Explicit height - browsers calculate textarea height from rows
       attribute first, then CSS.  We set both for maximum compatibility. */
    min-height: 20em;


    height: 32em;
    max-height: 80vh;

    resize: vertical;

    overflow: auto;

    padding: 1rem;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    background: var(--light-bg);

    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9rem;
    line-height: 1.4em;
    color: var(--text-dark);
    cursor: default;

    /* Suppress default inset shadow (Safari / Firefox) */
    -webkit-appearance: none;
    appearance: none;
}

.va-output:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

/* Allow textarea resizing (match vAnalytics behavior) */
textarea.modern-form-input {
    resize: vertical;
}


/* ----------------------------------------------------------
 * vAnalytics Save-to-vDrive modal
 *
 * CRITICAL: display:none MUST be isolated from flexbox properties.
 * Flexbox properties (justify-content, align-items) only work when
 * display is flex, so they live ONLY in the .active state.
 * ---------------------------------------------------------- */
.va-modal-overlay {
    /* Hidden by default - no flexbox properties here */
    display: none;

    /* Positioning - these work regardless of display value */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;

    background: rgba(44, 62, 80, 0.6);
}

.va-modal-overlay.active {
    /* Active state: display flex + flexbox layout properties */
    display: flex !important;
    justify-content: center;
    align-items: center;
}

.va-modal {
    background: white;
    border-radius: 12px;
    width: 440px;
    max-width: 90vw;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.va-modal-header {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    padding: 1.25rem 1.5rem;
}

.va-modal-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.va-modal-body {
    padding: 1.5rem;
}

.va-modal-body > label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 0.9rem;
}

/* Filename input + static .vtext extension suffix */
.va-filename-row {
    display: flex;
    align-items: stretch;
}

.va-filename-row input {
    flex: 1;
    padding: 0.6rem 0.85rem;
    border: 2px solid var(--border-color);
    border-radius: 8px 0 0 8px;
    font-size: 0.9rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.va-filename-row input:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.va-filename-ext {
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    background: var(--light-bg);
    border: 2px solid var(--border-color);
    border-left: none;
    border-radius: 0 8px 8px 0;
    color: var(--primary-purple);
    font-weight: 600;
    font-size: 0.85rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    white-space: nowrap;
    user-select: none;
}

.va-modal-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.va-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 0 1.5rem 1.5rem;
}

.va-modal-footer .modern-action-btn {
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
}

/* Dashboard */
.dashboard-actions-column {
    flex-direction: column;
    gap: 0.75rem;
}

.dashboard-action-link {
    text-align: center;
}

.dashboard-services-list {
    font-size: 0.9rem;
}

.dashboard-help-divider {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(102, 126, 234, 0.2);
}

.dashboard-support-link {
    color: var(--primary-purple);
    text-decoration: none;
    font-weight: 500;
}


/* Responsive */
@media (max-width: 768px) {
    .modern-dashboard {
        padding: 1rem;
    }

    .modern-form-container {
        margin: 1rem;
    }

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

    .modern-action-buttons {
        flex-direction: column;
    }

    .modern-action-btn {
        width: 100%;
        text-align: center;
    }
}
