/**
 * Dashboard Styles (User Panel)
 * 
 * @package Gestor_Suscripciones_Stripe
 */

/* Dashboard Header */
.gss-dashboard-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--gss-brand-color, #3b82f6) 0%, var(--gss-brand-secondary, #1e40af) 100%);
    border-radius: 0;
    color: #fff;
}
.gss-dashboard-logo { max-height: 40px; width: auto; }
.gss-dashboard-user-info { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.gss-user-greeting { font-size: 18px; font-weight: 600; }
.gss-user-level-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    background: rgba(255,255,255,0.2);
    width: fit-content;
}
.gss-logout-link {
    display: flex;
    align-items: center;
    gap: 4px;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}
.gss-logout-link:hover { color: #fff; }

/* Dashboard Tabs */
.gss-dashboard-tabs {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    overflow-x: auto;
}
.gss-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 20px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    min-width: 120px;
}
.gss-tab-btn:hover { background: #f1f5f9; color: #334155; }
.gss-tab-btn.active {
    color: var(--gss-brand-color, #3b82f6);
    border-bottom-color: var(--gss-brand-color, #3b82f6);
    background: #fff;
}
.gss-tab-btn .dashicons { font-size: 18px; width: 18px; height: 18px; }

/* Dashboard Content */
.gss-dashboard-content {
    background: #fff;
    border-radius: 0;
    box-shadow: none;
}
.gss-tab-content { display: none; padding: 24px; }
.gss-tab-content.active { display: block; }

/* Subscription Card */
.gss-subscription-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}
.gss-subscription-active { border-color: #10b981; }
.gss-subscription-header {
    padding: 12px 20px;
    background: #ecfdf5;
}
.gss-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}
.gss-status-active { background: #10b981; color: #fff; }
.gss-subscription-body { padding: 24px; }
.gss-plan-name { margin: 0 0 16px 0; font-size: 24px; color: #1e293b; }
.gss-subscription-details { display: flex; flex-wrap: wrap; gap: 24px; }
.gss-detail-item { display: flex; flex-direction: column; gap: 4px; }
.gss-detail-label { font-size: 13px; color: #64748b; }
.gss-detail-value { font-size: 15px; font-weight: 600; color: #1e293b; }
.gss-subscription-footer { padding: 16px 24px; background: #f8fafc; border-top: 1px solid #e2e8f0; }

/* Profile Card */
.gss-profile-card, .gss-billing-card {
    background: #fff;
    border: none;
    border-radius: 12px;
    padding: 24px;
    max-width: 600px;
    margin: 0 auto;
}
.gss-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 24px 0;
    font-size: 18px;
    color: #1e293b;
}
.gss-card-title .dashicons { color: var(--gss-brand-color, #3b82f6); }

/* Profile Tab Container - centered */
#profile.gss-tab-content {
    max-width: 640px;
    margin: 0 auto;
}

/* Profile Alert (incomplete profile warning) */
.gss-profile-alert {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #fef3c7, #fffbeb);
    border: 1px solid #fde68a;
    border-radius: 12px;
    margin-bottom: 24px;
}
.gss-profile-alert-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fbbf24;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gss-profile-alert-icon .dashicons {
    color: #fff;
    font-size: 20px;
    width: 20px;
    height: 20px;
}
.gss-profile-alert-content strong {
    display: block;
    font-size: 15px;
    color: #92400e;
    margin-bottom: 2px;
}
.gss-profile-alert-content p {
    margin: 0;
    font-size: 13px;
    color: #a16207;
    line-height: 1.4;
}

/* Profile Sections */
.gss-profile-section {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    background: #fff;
    transition: border-color 0.2s;
}
.gss-profile-section.gss-section-highlight {
    border-color: #fbbf24;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15);
}
.gss-profile-section-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 18px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
}
.gss-profile-section-header > .dashicons {
    flex-shrink: 0;
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: var(--gss-brand-color, #3b82f6);
    margin-top: 2px;
}
.gss-profile-section-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}
.gss-profile-section-header p {
    margin: 2px 0 0;
    font-size: 13px;
    color: #64748b;
}
.gss-profile-section-body {
    padding: 20px;
}
.gss-profile-section-body .gss-form-group:last-child {
    margin-bottom: 0;
}

/* Required field indicator */
.gss-required { color: #ef4444; font-weight: 600; }

/* Readonly input style */
.gss-input-readonly {
    background: #f1f5f9 !important;
    cursor: not-allowed !important;
    color: #64748b !important;
}

/* Field locked icon */
.gss-field-locked {
    display: inline-flex;
    margin-left: 4px;
    vertical-align: middle;
}
.gss-field-locked .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    color: #94a3b8;
}

/* Profile form footer */
.gss-profile-form-footer {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding-top: 4px;
}
.gss-profile-form-footer .gss-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.gss-profile-form-footer .gss-btn-primary .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Billing Type Segmented Switch */
.gss-billing-type-switch {
    display: flex;
    background: #f1f5f9;
    border-radius: 10px;
    padding: 4px;
    gap: 4px;
    margin-bottom: 0;
}
.gss-billing-switch-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    background: transparent;
    border: none;
    position: relative;
}
.gss-billing-switch-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}
.gss-billing-switch-option .gss-switch-icon {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #94a3b8;
    transition: color 0.2s;
}
.gss-billing-switch-option .gss-switch-label {
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    transition: color 0.2s;
    white-space: nowrap;
}
.gss-billing-switch-option:hover {
    background: rgba(255,255,255,0.6);
}
.gss-billing-switch-option.active {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
}
.gss-billing-switch-option.active .gss-switch-icon {
    color: var(--gss-brand-color, #3b82f6);
}
.gss-billing-switch-option.active .gss-switch-label {
    color: #1e293b;
    font-weight: 600;
}

/* Empresa fields (collapsible) */
.gss-billing-empresa-fields {
    overflow: hidden;
}
.gss-empresa-fields-inner {
    padding-top: 20px;
}

/* Legacy toggle support for modal */
.gss-billing-type-toggle {
    display: flex;
    background: #f1f5f9;
    border-radius: 10px;
    padding: 4px;
    gap: 4px;
    margin-bottom: 16px;
}
.gss-billing-type-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    background: transparent;
    border: none;
    position: relative;
}
.gss-billing-type-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}
.gss-billing-type-option .gss-check-indicator {
    display: none;
}
.gss-billing-type-option .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #94a3b8;
    transition: color 0.2s;
}
.gss-billing-type-option strong {
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    transition: color 0.2s;
}
.gss-billing-type-option span.gss-billing-type-desc {
    display: none;
}
.gss-billing-type-option:hover {
    background: rgba(255,255,255,0.6);
}
.gss-billing-type-option.active {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
}
.gss-billing-type-option.active .dashicons {
    color: var(--gss-brand-color, #3b82f6);
}
.gss-billing-type-option.active strong {
    color: #1e293b;
    font-weight: 600;
}

/* Pre-checkout billing modal */
.gss-billing-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 999999;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: gss-fade-in 0.2s ease;
}
@keyframes gss-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
.gss-billing-modal {
    background: #fff;
    border-radius: 16px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    overflow: hidden;
    max-height: 90vh;
    overflow-y: auto;
}
.gss-billing-modal-header {
    padding: 24px 24px 16px;
    text-align: center;
    border-bottom: 1px solid #f1f5f9;
}
.gss-billing-modal-header h3 {
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
}
.gss-billing-modal-header p {
    margin: 0;
    font-size: 14px;
    color: #64748b;
}
.gss-billing-modal-body {
    padding: 20px 24px;
}
.gss-billing-modal-body .gss-form-group {
    margin-bottom: 14px;
}
.gss-billing-modal-body .gss-form-group:last-child {
    margin-bottom: 0;
}
.gss-billing-modal-body label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #374151;
    font-size: 13px;
}
.gss-billing-modal-body .gss-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}
.gss-billing-modal-body .gss-input:focus {
    outline: none;
    border-color: var(--gss-brand-color, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.gss-billing-modal-summary {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.gss-billing-modal-summary .dashicons {
    color: var(--gss-brand-color, #3b82f6);
    font-size: 22px;
    width: 22px;
    height: 22px;
}
.gss-billing-modal-summary strong {
    font-size: 15px;
    color: #1e293b;
}
.gss-billing-modal-summary span {
    font-size: 13px;
    color: #64748b;
}
.gss-billing-modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
}
.gss-billing-modal-footer button,
.gss-billing-modal-footer a {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
}
.gss-billing-modal-footer .gss-modal-cancel {
    background: #f3f4f6;
    color: #374151;
}
.gss-billing-modal-footer .gss-modal-cancel:hover {
    background: #e5e7eb;
}
.gss-billing-modal-footer .gss-modal-confirm {
    background: var(--gss-brand-color, #3b82f6);
    color: #fff;
}
.gss-billing-modal-footer .gss-modal-confirm:hover {
    background: var(--gss-brand-color-hover, #2563eb);
}

/* Form Styles */
.gss-form-modern .gss-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.gss-form-modern .gss-form-group { margin-bottom: 16px; }
.gss-form-modern label { display: block; margin-bottom: 6px; font-weight: 500; color: #374151; font-size: 14px; }
.gss-form-modern .gss-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.gss-form-modern .gss-input:focus {
    outline: none;
    border-color: var(--gss-brand-color, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.gss-form-divider { margin: 24px 0; border: none; border-top: 1px solid #e5e7eb; }
.gss-form-section-title { margin: 0 0 8px 0; font-size: 16px; color: #374151; }
.gss-form-hint { margin: 0 0 16px 0; font-size: 13px; color: #6b7280; }
.gss-form-actions { margin-top: 24px; }
.gss-form-message { margin-top: 16px; }
.gss-form-message .gss-success { padding: 12px 16px; background: #d1fae5; color: #065f46; border-radius: 8px; }
.gss-form-message .gss-error { padding: 12px 16px; background: #fee2e2; color: #991b1b; border-radius: 8px; }

/* Billing */
.gss-billing-features { list-style: none; padding: 0; margin: 16px 0 24px 0; }
.gss-billing-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    color: #374151;
}
.gss-billing-features .dashicons { color: #10b981; }
.gss-billing-actions { margin: 24px 0; }
.gss-billing-note {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #6b7280;
}
.gss-billing-note .dashicons { font-size: 16px; width: 16px; height: 16px; }

/* Buttons */
.gss-dashboard-content .gss-btn-primary,
.gss-dashboard-content .gss-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 3px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.gss-dashboard-content .gss-btn-primary {
    background: var(--gss-brand-color, #3b82f6);
    color: #fff;
}
.gss-dashboard-content .gss-btn-primary:hover { background: var(--gss-brand-color-hover, #2563eb); }
.gss-dashboard-content .gss-btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}
.gss-dashboard-content .gss-btn-secondary:hover { background: #e2e8f0; }

/* Empty State */
.gss-empty-state {
    text-align: center;
    padding: 40px 20px;
}
.gss-empty-state h3 { margin: 16px 0 8px 0; color: #1e293b; }
.gss-empty-state p { margin: 0 0 24px 0; color: #64748b; }

/* Spinner */
.gss-dashboard-content .gss-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: gss-spin 0.8s linear infinite;
}
.gss-spin { animation: gss-spin 1s linear infinite; }
@keyframes gss-spin { to { transform: rotate(360deg); } }

/* Legal Tab */
.gss-legal-tab { }
.gss-legal-docs-accordion { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.gss-legal-doc-item { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 10px; overflow: hidden; }
.gss-legal-doc-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}
.gss-legal-doc-btn:hover { background: #f3f4f6; }
.gss-legal-doc-btn[aria-expanded="true"] { background: #fff; color: var(--gss-brand-color, #3b82f6); }
.gss-legal-doc-btn-text { flex: 1; }
.gss-legal-doc-icon { flex-shrink: 0; font-size: 20px; font-weight: 300; line-height: 1; color: #6b7280; transition: color 0.15s; }
.gss-legal-doc-btn[aria-expanded="true"] .gss-legal-doc-icon { color: var(--gss-brand-color, #3b82f6); }
.gss-legal-doc-content {
    padding: 4px 20px 18px;
    font-size: 14px;
    line-height: 1.7;
    color: #4b5563;
    background: #fff;
}
.gss-legal-doc-content[hidden] { display: none; }

/* Invoices Table */
.gss-invoices-table { width: 100%; border-collapse: collapse; }
.gss-invoices-table th, .gss-invoices-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #e2e8f0; }
.gss-invoices-table th { background: #f8fafc; font-weight: 600; color: #475569; font-size: 13px; text-transform: uppercase; }
.gss-invoices-table td.text-right, .gss-invoices-table th.text-right { text-align: right; }
.gss-invoices-table tbody tr:hover { background: #f8fafc; }
.gss-download-invoice-btn { display: inline-flex; align-items: center; gap: 6px; color: var(--gss-brand-color, #3b82f6); text-decoration: none !important; }
.gss-download-invoice-btn:hover { color: var(--gss-brand-secondary, #1e40af); text-decoration: none !important; }
.gss-download-text { display: none; }
.gss-invoice-status { display: inline-block; padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.gss-invoice-status.gss-status-paid { background: #dcfce7; color: #166534; }
.gss-invoice-status.gss-status-pending { background: #fef3c7; color: #92400e; }

/* Responsive */
@media (max-width: 640px) {
    .gss-dashboard-header { 
        flex-direction: column; 
        align-items: flex-start;
        gap: 12px;
    }
    .gss-dashboard-user-info {
        width: 100%;
    }
    .gss-logout-link {
        align-self: flex-end;
        margin-top: -32px;
    }
    .gss-form-modern .gss-form-row { grid-template-columns: 1fr; }
    .gss-empresa-fields-inner .gss-form-row { grid-template-columns: 1fr; }
    .gss-billing-switch-option .gss-switch-label { font-size: 13px; }
    .gss-billing-switch-option { padding: 9px 12px; gap: 6px; }
    .gss-billing-type-option { padding: 9px 12px; gap: 6px; }
    .gss-billing-type-option strong { font-size: 13px; }
    .gss-tab-btn .gss-tab-text { display: none; }
    .gss-tab-btn { min-width: auto; padding: 16px; }

    /* Tabla de facturas responsive */
    .gss-invoices-table { display: block; }
    .gss-invoices-table thead { display: none; }
    .gss-invoices-table tbody { display: block; }
    .gss-invoices-table tr {
        display: block;
        margin-bottom: 16px;
        background: #f8fafc;
        border-radius: 12px;
        padding: 16px;
        border: 1px solid #e2e8f0;
    }
    .gss-invoices-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid #e2e8f0;
        text-align: right;
    }
    .gss-invoices-table td:last-child {
        border-bottom: none;
        justify-content: center;
        padding-top: 12px;
    }
    .gss-invoices-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #475569;
        text-align: left;
    }
    .gss-invoices-table td.text-right { text-align: right; }
    .gss-download-text { display: inline; }
    .gss-download-invoice-btn {
        background: var(--gss-brand-color, #3b82f6);
        color: #fff !important;
        padding: 9px 14px;
        border-radius: 8px;
        font-size: 13px;
        display: inline-flex;
        align-items: center;
        gap: 5px;
        white-space: nowrap;
        width: 100%;
        justify-content: center;
        box-sizing: border-box;
    }
    .gss-download-invoice-btn:hover {
        background: var(--gss-brand-secondary, #1e40af);
        color: #fff !important;
    }
    .gss-download-text {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}
