/* Customer Portal Styles */

/* Modal Overlay */
#mfs-portal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    padding: 20px;
}

#mfs-portal-overlay.hidden {
    display: none;
}

/* Close Button */
.mfs-modal-close {
    position: absolute;
    top: 4px;
    right: 4px;
    background: transparent;
    border: none;
    font-size: 36px;
    color: #000;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    z-index: 10;
    line-height: 1;
    padding: 0;
    font-weight: 300;
}

.mfs-modal-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

/* Remove ALL button styling when Gravatar is present - ultra specific to override theme */
.ast-header-button-1 a[href*="customer-portal"] img,
.ast-header-button-1 a img.mfs-gravatar-btn {
    display: block !important;
    margin: 0 !important;
}

.ast-header-button-1 a[data-has-gravatar="true"],
.ast-header-button-1 a[href*="customer-portal"]:has(img),
.ast-header-button-1 a:has(img.mfs-gravatar-btn),
a[href*="customer-portal"]:has(img),
a[data-has-gravatar="true"] {
    background: transparent !important;
    background-color: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    min-width: auto !important;
    width: auto !important;
    height: auto !important;
}

/* Prevent theme from changing button on hover/active/focus/visited */
.ast-header-button-1 a[data-has-gravatar="true"]:hover,
.ast-header-button-1 a[data-has-gravatar="true"]:active,
.ast-header-button-1 a[data-has-gravatar="true"]:focus,
.ast-header-button-1 a[data-has-gravatar="true"]:visited,
.ast-header-button-1 a[href*="customer-portal"]:has(img):hover,
.ast-header-button-1 a[href*="customer-portal"]:has(img):active,
.ast-header-button-1 a[href*="customer-portal"]:has(img):focus,
.ast-header-button-1 a[href*="customer-portal"]:has(img):visited {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Hide gravatar and email in dropdown, show "Profile" text instead */
.ast-account-nav-menu img,
.ast-account-nav-menu .ast-account-avatar,
.ast-account-nav-menu .ast-account-avatar img {
    display: none !important;
    visibility: hidden !important;
}

.ast-account-nav-menu .ast-account-title-name,
.ast-account-nav-menu .ast-account-name,
.ast-account-nav-menu .woocommerce-MyAccount-navigation-link--customer-logout {
    display: none !important;
}

/* Add Profile text at top of dropdown */
.ast-account-nav-menu {
    position: relative;
}

.ast-account-nav-menu::before {
    content: "Profile";
    font-weight: 600;
    color: #333;
    font-size: 16px;
    display: block !important;
    padding: 12px 20px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}

#mfs-portal-container {
    max-width: 480px;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Portal Views */
.mfs-portal-view {
    min-height: auto;
}

/* Loading State */
.mfs-loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

/* Login Card */
.mfs-portal-card {
    background: #fff;
    border: none;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
    position: relative;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Auth Tabs */
.mfs-auth-tabs {
    display: flex;
    border-bottom: 1px solid #e5e5e5;
    margin: 0;
    gap: 0;
    background: #fafafa;
}

.mfs-auth-tab {
    flex: 1;
    padding: 18px 20px;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    letter-spacing: 0.3px;
}

.mfs-auth-tab:hover {
    color: #555;
}

.mfs-auth-tab.active {
    color: #1a1a1a;
    border-bottom-color: #1a1a1a;
    background: #fff;
}

/* Auth Forms */
.mfs-auth-form {
    display: none;
}

#mfs-signin-form.mfs-auth-form.active,
#mfs-signup-form.mfs-auth-form.active {
    display: block !important;
    padding: 20px 50px 40px 50px !important;
    margin: 0 !important;
}

.mfs-auth-form.active {
    display: block;
    padding: 20px 50px 40px 50px !important;
    margin: 0 !important;
}

.mfs-auth-form h2 {
    display: none;
}

.mfs-auth-form > p {
    display: none;
}

/* Divider */
.mfs-divider {
    margin: 24px 0;
    text-align: center;
    position: relative;
}

.mfs-divider::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: #e5e5e5;
}

.mfs-divider span {
    background: white;
    padding: 0 16px;
    color: #888;
    font-size: 13px;
    position: relative;
    z-index: 1;
    font-weight: 500;
}

/* Form Styles */
.mfs-form-group {
    margin-bottom: 18px;
}

.mfs-form-group small {
    display: block;
    margin-top: 6px;
    color: #666;
    font-size: 12px;
    font-weight: 500;
}

.mfs-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #1a1a1a;
    font-size: 13px;
    letter-spacing: 0.2px;
}

.mfs-form-group input[type="email"],
.mfs-form-group input[type="password"],
.mfs-form-group input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    transition: all 0.2s ease;
    font-family: inherit;
    background: #fafafa;
    height: 36px;
    color: #000 !important;
    -webkit-text-fill-color: #000 !important;
}

.mfs-form-group input::placeholder {
    color: #999 !important;
    opacity: 1 !important;
}

.mfs-password-wrapper {
    position: relative;
}

.mfs-password-wrapper input {
    padding-right: 40px;
}

.mfs-password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #666;
    font-size: 14px;
    line-height: 1;
    transition: color 0.2s;
}

.mfs-password-toggle:hover {
    color: #1a1a1a;
}

.mfs-form-group input[type="email"]:focus,
.mfs-form-group input[type="password"]:focus,
.mfs-form-group input[type="text"]:focus {
    outline: none;
    border-color: #1a1a1a;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}

.mfs-instructions {
    background: #f0f6fc;
    border-left: 3px solid #0073aa;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #333;
    border-radius: 4px;
}

/* Buttons */
.mfs-button {
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    letter-spacing: 0.5px;
    width: 100%;
    margin-top: 8px;
}

.mfs-button-primary {
    background: #1a1a1a;
    color: #fff;
}

.mfs-button-primary:hover {
    background: #000;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.mfs-button-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.mfs-button-secondary {
    background: transparent;
    color: #1a1a1a;
    border: 1px solid #d0d0d0;
    margin-top: 12px;
}

.mfs-button-secondary:hover {
    background: #f5f5f5;
    border-color: #1a1a1a;
}

.mfs-button-danger {
    background: #dc3232;
    color: #fff;
    font-size: 14px;
    padding: 8px 16px;
}

.mfs-button-danger:hover {
    background: #c12020;
}

.mfs-button-danger:disabled {
    background: #f0a0a0;
    cursor: not-allowed;
}

/* Messages */
.mfs-message {
    padding: 14px 18px;
    margin-top: 18px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 500;
}

.mfs-message-success {
    background: #f0f9f4;
    border: 1px solid #d1e7dd;
    color: #0f5132;
}

.mfs-message-error {
    background: #fff5f5;
    border: 1px solid #ffdddd;
    color: #c41e3a;
}

/* Portal Header */
.mfs-portal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.mfs-portal-header h2 {
    margin: 0;
    font-size: 28px;
    color: #fff;
}

.mfs-license-count {
    font-size: 18px;
    font-weight: normal;
    opacity: 0.8;
}

/* License Cards */
.mfs-license-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.mfs-license-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
    gap: 16px;
}

.mfs-product-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.mfs-license-info {
    flex: 1;
    min-width: 0;
}

.mfs-license-header h3 {
    margin: 0 0 12px 0;
    font-size: 20px;
    color: #333;
}

.mfs-license-key-label {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.mfs-license-key {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #333;
    background: #f5f5f5;
    padding: 6px 10px;
    border-radius: 3px;
    display: inline-block;
}

.mfs-license-status {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mfs-status-active {
    background: #d4edda;
    color: #155724;
}

.mfs-status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.mfs-status-expired {
    background: #fff3cd;
    color: #856404;
}

/* Activations Summary */
.mfs-activations-summary {
    margin-bottom: 20px;
    font-size: 16px;
    color: #333;
}

.mfs-activations-remaining {
    color: #28a745;
    font-weight: 500;
}

.mfs-activations-full {
    color: #dc3545;
    font-weight: 500;
}

.mfs-action-buttons {
    float: right;
    display: flex;
    gap: 10px;
}

.mfs-download-btn,
.mfs-invoice-btn {
    padding: 6px 12px;
    color: #fff !important;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
    white-space: nowrap;
}

.mfs-download-btn {
    background: #28a745;
}

.mfs-download-btn:hover {
    background: #218838;
}

.mfs-invoice-btn {
    background: #0073aa;
}

.mfs-invoice-btn:hover {
    background: #005a87;
}

/* Activations List */
.mfs-activations-list h4 {
    margin: 20px 0 12px 0;
    font-size: 16px;
    color: #555;
}

.mfs-activation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    margin-bottom: 10px;
}

.mfs-activation-details {
    flex: 1;
}

.mfs-activation-name {
    font-size: 15px;
    color: #333;
    margin-bottom: 5px;
}

.mfs-activation-meta {
    font-size: 13px;
    color: #777;
}

.mfs-activation-meta span {
    margin-right: 15px;
}

.mfs-no-activations {
    padding: 20px;
    text-align: center;
    color: #999;
    font-style: italic;
}

.mfs-no-licenses {
    padding: 60px 40px;
    text-align: center;
    color: #555;
    font-size: 18px;
    background: #f9f9f9;
    border-radius: 8px;
    margin: 20px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    #mfs-portal-container {
        padding: 15px;
    }

    .mfs-portal-card {
        padding: 25px 20px;
    }

    .mfs-portal-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .mfs-portal-header button {
        margin-top: 15px;
    }

    .mfs-license-header {
        flex-wrap: wrap;
    }

    .mfs-product-image {
        width: 60px;
        height: 60px;
    }

    .mfs-license-info {
        flex: 1 1 calc(100% - 76px);
    }

    .mfs-license-status {
        margin-top: 10px;
        width: 100%;
    }

    .mfs-activation-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .mfs-activation-item button {
        margin-top: 12px;
        width: 100%;
    }

    .mfs-action-buttons {
        float: none;
        margin-top: 10px;
        flex-wrap: wrap;
    }

    .mfs-activations-summary {
        display: flex;
        flex-direction: column;
    }
}
