/*
 * VD Portal - Optimized Two-Column Layout
 * Clean, modern design with responsive behavior
 */

/* Portal Wrapper */
.vd-portal-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Portal Header */
.vd-portal-header {
    text-align: center;
    margin-bottom: 30px;
}

.vd-portal-header h1 {
    color: #2c3e50;
    margin: 0 0 10px 0;
    font-size: 2.5em;
    font-weight: 600;
}

.vd-portal-header p {
    color: #7f8c8d;
    font-size: 1.1em;
    margin: 0;
}

/* Two-Column Container - CRITICAL LAYOUT */
.vd-portal-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

/* LEFT PANEL - 60% Main Content */
.vd-portal-main {
    flex: 1 1 60%;
    max-width: 60%;
}

/* RIGHT SIDEBAR - 40% */
.vd-portal-sidebar {
    flex: 0 0 40%;
    max-width: 40%;
    position: sticky;
    top: 20px;
}

/* Card Component */
.vd-card {
    background: #ffffff;
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s ease;
}

.vd-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.vd-card h2,
.vd-card h3 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 1.4em;
    font-weight: 600;
}

/* Form Styling */
.vd-form-group {
    margin-bottom: 20px;
}

.vd-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #34495e;
}

.vd-form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.vd-form-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Button Styling */
.vd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    gap: 8px;
}

.vd-btn-primary {
    background: #3498db;
    color: white;
}

.vd-btn-primary:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

/* Info Grid */
.vd-info-grid {
    display: grid;
    gap: 16px;
}

.vd-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
}

.vd-info-item .label {
    font-weight: 500;
    color: #6c757d;
}

.vd-info-item .value {
    font-weight: 600;
    color: #2c3e50;
}

/* Tabs Styling */
.vd-tabs {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.vd-tab-buttons {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e8ed;
}

.vd-tab-btn {
    flex: 1;
    padding: 16px 20px;
    background: transparent;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s ease;
}

.vd-tab-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.vd-tab-btn.active {
    background: white;
    color: #3498db;
    border-bottom: 2px solid #3498db;
}

.vd-tab-content {
    display: none;
    padding: 20px;
}

.vd-tab-content.active {
    display: block;
}

.vd-tab-content .vd-card {
    margin: 0;
    border: none;
    box-shadow: none;
    padding: 0;
}

/* Empty State */
.vd-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.vd-empty-state p {
    margin: 0;
    font-size: 1.1em;
}

/* Responsive Design - Enhanced Mobile UX */
@media (max-width: 768px) {
    .vd-portal-container {
        flex-direction: column;
        gap: 20px;
    }

    .vd-portal-main,
    .vd-portal-sidebar {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .vd-portal-sidebar {
        position: static;
        margin-top: 0 !important;
    }

    .vd-portal-wrapper {
        padding: 15px;
    }

    .vd-portal-header h1 {
        font-size: 2em;
    }

    /* ===========================
       MOBILE TAB CONSISTENCY FIX
       =========================== */

    /* Make sidebar tabs section look like credential cards */
    .vd-tabs {
        background: #ffffff !important;
        border: 1px solid #e1e8ed !important;
        border-radius: 12px !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
        overflow: hidden;
        margin-bottom: 20px;
    }

    /* Tab header - match card styling */
    .vd-tab-buttons {
        background: #f8f9fa !important;
        border-bottom: 1px solid #e1e8ed !important;
        margin: 0;
        padding: 0;
        flex-direction: row;  /* Keep horizontal on mobile */
    }

    .vd-tab-btn {
        text-align: center;
        padding: 16px;  /* Larger touch targets */
        min-height: 56px;    /* Minimum 44px touch target */
        border: none;
        background: transparent;
        font-size: 14px;
        font-weight: 500;
        transition: all 0.2s ease;
    }

    .vd-tab-btn.active {
        background: #ffffff !important;
        color: #3498db !important;
        border-bottom: 2px solid #3498db !important;
    }

    /* Tab content - match card interior */
    .vd-tab-content {
        display: none;
        padding: 20px !important;
    }

    .vd-tab-content.active {
        display: block;
    }

    /* Remove nested card styling on mobile */
    .vd-tab-content .vd-card {
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        background: transparent !important;
    }

    /* Tab content headings */
    .vd-tab-content h3 {
        font-size: 1.2em !important;
        font-weight: 600 !important;
        margin-bottom: 16px !important;
        color: #2c3e50 !important;
    }

    /* Better spacing for credential fields on mobile */
    .vd-credential-value {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }

    .vd-credential-value .value {
        margin-bottom: 0;
        font-size: 16px;  /* Prevent zoom on iOS */
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .vd-btn-copy {
        width: 100%;
        min-height: 44px;
        padding: 12px;
        font-size: 18px;
    }

    /* Larger form inputs for mobile */
    .vd-form-group input {
        font-size: 16px;  /* Prevent zoom on iOS */
        min-height: 44px;
        padding: 16px;
    }

    .vd-btn {
        min-height: 48px;
        padding: 14px 24px;
        font-size: 16px;
    }

    /* Better spacing for cards */
    .vd-card {
        padding: 20px;
        margin-bottom: 16px;
    }

    .vd-info-item {
        padding: 16px;
        margin-bottom: 8px;
    }

    /* Action buttons stack on mobile */
    .vd-actions {
        flex-direction: column;
        gap: 8px;
    }

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

@media (max-width: 480px) {
    .vd-portal-header h1 {
        font-size: 1.8em;
        margin-bottom: 8px;
    }

    .vd-portal-header p {
        font-size: 1em;
    }

    .vd-card {
        padding: 16px;
        margin-bottom: 12px;
    }

    .vd-card h2,
    .vd-card h3 {
        font-size: 1.2em;
        margin-bottom: 16px;
    }

    /* Keep minimum sizes for accessibility */
    .vd-form-group input {
        font-size: 16px;  /* Don't go below 16px on mobile */
        padding: 14px;
    }

    .vd-btn {
        padding: 12px 20px;
        font-size: 16px;  /* Keep readable size */
        min-height: 44px;
    }

    /* Credential fields on very small screens */
    .vd-credential-value .value {
        font-size: 14px;
        padding: 12px;
        line-height: 1.4;
        word-wrap: break-word;
    }

    .vd-btn-copy {
        font-size: 16px;
        padding: 10px;
    }

    /* Tighter spacing on small screens */
    .vd-portal-wrapper {
        padding: 12px;
    }

    .vd-info-item {
        padding: 12px;
    }

    .vd-tab-content {
        padding: 16px;
    }

    /* Stack tab buttons on very small screens */
    .vd-tab-buttons {
        flex-direction: column;
    }

    .vd-tab-btn {
        padding: 16px;
        width: 100%;
    }
}

/* Loading States */
.vd-loading {
    opacity: 0.6;
    pointer-events: none;
}

.vd-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Credential Fields with Copy Buttons */
.vd-credential-field {
    width: 100%;
}

.vd-credential-value {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

.vd-credential-value .value {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #e1e8ed;
    word-break: break-all;
}

.vd-btn-copy {
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vd-btn-copy:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.vd-btn-copy.copied {
    background: #27ae60;
    transform: scale(1.1);
}

.vd-btn-copy.copy-error {
    background: #e74c3c;
    transform: scale(1.1);
}

/* Action Buttons */
.vd-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.vd-btn-secondary {
    background: #95a5a6;
    color: white;
}

.vd-btn-secondary:hover {
    background: #7f8c8d;
}

.vd-btn-outline {
    background: transparent;
    color: #3498db;
    border: 2px solid #3498db;
}

.vd-btn-outline:hover {
    background: #3498db;
    color: white;
}

/* Success/Error States */
.vd-success {
    color: #27ae60;
    background: #d5f4e6;
    border: 1px solid #27ae60;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 16px 0;
}

.vd-error {
    color: #e74c3c;
    background: #fdf2f2;
    border: 1px solid #e74c3c;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 16px 0;
}