/* Custom Profile Manager - Modern Frontend Styles */

/* Variables */
:root {
    --cpm-primary: #667eea;
    --cpm-primary-dark: #5a67d8;
    --cpm-secondary: #48bb78;
    --cpm-danger: #f56565;
    --cpm-dark: #2d3748;
    --cpm-gray: #718096;
    --cpm-light: #f7fafc;
    --cpm-border: #e2e8f0;
    --cpm-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --cpm-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --cpm-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --cpm-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --cpm-radius: 12px;
}

/* Main Container */
.cpm-profile-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0;
    background: transparent;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Header Card */
.cpm-header {
    background: linear-gradient(135deg, var(--cpm-primary) 0%, var(--cpm-primary-dark) 100%);
    color: white;
    padding: 40px;
    border-radius: var(--cpm-radius);
    margin-bottom: 30px;
    box-shadow: var(--cpm-shadow-lg);
    position: relative;
    overflow: hidden;
}

.cpm-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 50%;
    height: 200%;
    background: rgba(255, 255, 255, 0.05);
    transform: rotate(35deg);
}

.cpm-header h2 {
    font-size: 32px;
    font-weight: 700;
    margin: 0;
    position: relative;
    z-index: 1;
    letter-spacing: -0.5px;
}

/* Avatar Section Card */
.cpm-avatar-section {
    background: white;
    border-radius: var(--cpm-radius);
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: var(--cpm-shadow);
    border: 1px solid var(--cpm-border);
    text-align: center;
    position: relative;
}

.cpm-avatar-wrapper {
    margin-bottom: 25px;
    position: relative;
    display: inline-block;
}

.cpm-avatar {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid white;
    box-shadow: var(--cpm-shadow-xl);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cpm-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 25px 35px -5px rgba(102, 126, 234, 0.25);
}

.cpm-avatar-wrapper::after {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(135deg, var(--cpm-primary), var(--cpm-secondary));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    z-index: -1;
}

.cpm-avatar-info {
    color: var(--cpm-gray);
    font-size: 14px;
    margin-top: 12px;
    font-weight: 500;
}

/* Form Sections as Cards */
.cpm-form-section {
    background: white;
    border-radius: var(--cpm-radius);
    padding: 35px;
    margin-bottom: 30px;
    box-shadow: var(--cpm-shadow);
    border: 1px solid var(--cpm-border);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.cpm-form-section:hover {
    box-shadow: var(--cpm-shadow-xl);
    transform: translateY(-2px);
}

.cpm-form-section h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--cpm-dark);
    margin: 0 0 30px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--cpm-border);
    position: relative;
}

.cpm-form-section h3::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, var(--cpm-primary), var(--cpm-secondary));
}

/* Form Groups */
.cpm-form-group {
    margin-bottom: 28px;
}

.cpm-form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--cpm-dark);
    font-size: 15px;
    letter-spacing: -0.2px;
}

.cpm-form-group input[type="text"],
.cpm-form-group input[type="email"],
.cpm-form-group input[type="tel"],
.cpm-form-group input[type="password"],
.cpm-form-group textarea,
.cpm-form-group select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--cpm-border);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: white;
}

.cpm-form-group input:focus,
.cpm-form-group textarea:focus,
.cpm-form-group select:focus {
    outline: none;
    border-color: var(--cpm-primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.cpm-form-group input:hover,
.cpm-form-group textarea:hover,
.cpm-form-group select:hover {
    border-color: #cbd5e0;
}

.cpm-form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* Form Row - Grid Layout */
.cpm-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

/* Required Field */
.required {
    color: var(--cpm-danger);
    font-weight: 700;
}

/* Help Text */
.cpm-help-text {
    display: block;
    margin-top: 8px;
    color: var(--cpm-gray);
    font-size: 13px;
    line-height: 1.5;
    font-style: italic;
}

/* Radio and Checkbox Groups - Modern Style */
.cpm-radio-group,
.cpm-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 15px;
}

.cpm-radio,
.cpm-checkbox {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    background: var(--cpm-light);
    border: 2px solid var(--cpm-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 140px;
}

.cpm-radio:hover,
.cpm-checkbox:hover {
    background: white;
    border-color: var(--cpm-primary);
    box-shadow: var(--cpm-shadow-sm);
}

.cpm-radio input[type="radio"],
.cpm-checkbox input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.cpm-radio input[type="radio"]:checked + span,
.cpm-checkbox input[type="checkbox"]:checked + span {
    color: var(--cpm-primary);
    font-weight: 600;
}

.cpm-radio:has(input:checked),
.cpm-checkbox:has(input:checked) {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(102, 126, 234, 0.1));
    border-color: var(--cpm-primary);
}

.cpm-checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

/* Buttons - Modern Style */
.cpm-btn {
    display: inline-block;
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    letter-spacing: -0.2px;
}

.cpm-btn-primary {
    background: linear-gradient(135deg, var(--cpm-primary), var(--cpm-primary-dark));
    color: white;
    box-shadow: 0 4px 15px 0 rgba(102, 126, 234, 0.3);
}

.cpm-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px 0 rgba(102, 126, 234, 0.4);
}

.cpm-btn-primary:active {
    transform: translateY(0);
}

.cpm-btn-danger {
    background: linear-gradient(135deg, var(--cpm-danger), #e53e3e);
    color: white;
    margin-top: 15px;
    box-shadow: 0 4px 15px 0 rgba(245, 101, 101, 0.3);
}

.cpm-btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px 0 rgba(245, 101, 101, 0.4);
}

.cpm-btn-lg {
    padding: 18px 45px;
    font-size: 17px;
    border-radius: 10px;
}

.cpm-btn .dashicons {
    margin-right: 8px;
    vertical-align: middle;
    font-size: 18px;
}

/* Form Actions */
.cpm-form-actions {
    margin-top: 40px;
    text-align: center;
    padding: 35px;
    background: linear-gradient(135deg, var(--cpm-light), white);
    border-radius: var(--cpm-radius);
    box-shadow: var(--cpm-shadow);
}

/* Messages */
.cpm-message {
    padding: 20px 25px;
    margin: 30px 0;
    border-radius: 10px;
    font-size: 15px;
    line-height: 1.6;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.cpm-message::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    border-radius: 10px 0 0 10px;
}

.cpm-message.success {
    background: linear-gradient(135deg, #d4edda, #e8f5e9);
    color: #155724;
    border: 1px solid #c3e6cb;
    position: relative;
    padding-left: 35px;
}

.cpm-message.success::before {
    background: var(--cpm-secondary);
}

.cpm-message.error {
    background: linear-gradient(135deg, #f8d7da, #ffebee);
    color: #721c24;
    border: 1px solid #f5c6cb;
    position: relative;
    padding-left: 35px;
}

.cpm-message.error::before {
    background: var(--cpm-danger);
}

/* Loading Spinner */
.cpm-loading {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Password Section Special Styling */
.cpm-form-section:has(input[type="password"]) {
    background: linear-gradient(135deg, #fafafa, white);
    border-left: 4px solid var(--cpm-primary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .cpm-profile-container {
        margin: 20px;
        padding: 0 15px;
    }
    
    .cpm-header {
        padding: 30px 25px;
    }
    
    .cpm-header h2 {
        font-size: 26px;
    }
    
    .cpm-avatar {
        width: 140px;
        height: 140px;
    }
    
    .cpm-form-section {
        padding: 25px;
    }
    
    .cpm-form-section h3 {
        font-size: 20px;
    }
    
    .cpm-form-row {
        grid-template-columns: 1fr;
    }
    
    .cpm-checkbox-group {
        grid-template-columns: 1fr;
    }
    
    .cpm-btn-lg {
        width: 100%;
    }
}

/* Animation Effects */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cpm-form-section {
    animation: fadeInUp 0.6s ease-out;
}

.cpm-form-section:nth-child(2) {
    animation-delay: 0.1s;
}

.cpm-form-section:nth-child(3) {
    animation-delay: 0.2s;
}

.cpm-form-section:nth-child(4) {
    animation-delay: 0.3s;
}

/* Input Focus Effects */
.cpm-form-group input:focus,
.cpm-form-group textarea:focus {
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
    }
}

/* Tooltip Styles */
.cpm-tooltip {
    position: absolute;
    background: var(--cpm-dark);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
}

.cpm-tooltip::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid var(--cpm-dark);
}

/* Error State */
.cpm-form-group input.error,
.cpm-form-group textarea.error {
    border-color: var(--cpm-danger);
    background: #fff5f5;
}

.error-message {
    color: var(--cpm-danger);
    font-size: 13px;
    margin-top: 5px;
    font-weight: 500;
}