:root {
    /* رنگ‌های اصلی */
    --pf-primary: #4361ee;
    --pf-secondary: #3f37c9;
    --pf-success: #4caf50;
    --pf-danger: #f44336;
    --pf-warning: #ff9800;
    --pf-info: #2196f3;
    
    /* رنگ‌های متن و پس‌زمینه */
    --pf-text: #333333;
    --pf-text-light: #666666;
    --pf-bg: #ffffff;
    --pf-bg-light: #f5f5f5;
    
    /* سایه‌ها */
    --pf-shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --pf-shadow: 0 4px 6px rgba(0,0,0,0.1);
    --pf-shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    
    /* فواصل */
    --pf-space-xs: 0.25rem;
    --pf-space-sm: 0.5rem;
    --pf-space-md: 1rem;
    --pf-space-lg: 1.5rem;
    --pf-space-xl: 2rem;
}

/* Container */
.phoenix-form-wrapper {
    max-width: 100%;
    margin: 0 auto;
}

/* Form Layout */
.phoenix-form {
    display: grid;
    gap: var(--pf-space-md);
    padding: var(--pf-space-lg);
    background: var(--pf-bg);
    border-radius: 8px;
    box-shadow: var(--pf-shadow);
}

/* Grid System */
.phoenix-form-grid {
    display: grid;
    gap: var(--pf-space-md);
}

@media (min-width: 768px) {
    .phoenix-form-grid {
        grid-template-columns: repeat(var(--columns, 12), 1fr);
    }
    
    .width-100 { grid-column: span 12; }
    .width-75 { grid-column: span 9; }
    .width-66 { grid-column: span 8; }
    .width-50 { grid-column: span 6; }
    .width-33 { grid-column: span 4; }
    .width-25 { grid-column: span 3; }
}

/* Form Fields */
.form-field {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--pf-space-xs);
}

.field-label {
    font-weight: 500;
    color: var(--pf-text);
}

.field-input {
    padding: var(--pf-space-sm) var(--pf-space-md);
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.field-input:focus {
    border-color: var(--pf-primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
    outline: none;
}

/* Submit Button */
.submit-wrapper {
    display: flex;
    justify-content: var(--submit-align, flex-end);
    grid-column: 1 / -1;
    margin-top: var(--pf-space-lg);
}

.submit-button {
    padding: var(--pf-space-sm) var(--pf-space-xl);
    background: var(--pf-primary);
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-button:hover {
    background: var(--pf-secondary);
    transform: translateY(-1px);
    box-shadow: var(--pf-shadow);
}

.submit-button.full-width {
    width: 100%;
}

/* Custom Radio & Checkbox */
.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--pf-space-sm);
}

.radio-wrapper,
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: var(--pf-space-sm);
}

/* Helper Text */
.helper-text {
    font-size: 0.875rem;
    color: var(--pf-text-light);
    margin-top: var(--pf-space-xs);
}

/* Error States */
.has-error .field-input {
    border-color: var(--pf-danger);
    background-color: rgba(244, 67, 54, 0.05);
}

.error-message {
    color: var(--pf-danger);
    font-size: 0.875rem;
    margin-top: var(--pf-space-xs);
}

/* Loading State */
.submit-button.loading {
    position: relative;
    color: transparent;
}

.submit-button.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* RTL Support */
.rtl .phoenix-form {
    direction: rtl;
}

/* Responsive Design */
@media (max-width: 768px) {
    .phoenix-form-grid {
        grid-template-columns: 1fr;
    }
    
    .width-100, .width-75, .width-66, .width-50, .width-33, .width-25 {
        grid-column: 1 / -1;
    }
    
    .submit-wrapper {
        justify-content: stretch;
    }
    
    .submit-button {
        width: 100%;
    }
}

/* Popup Styles */
.phoenix-form-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 1 !important;
    visibility: visible !important;
    transition: all 0.3s ease;
    direction: rtl;
}

.phoenix-form-popup.show {
    opacity: 1;
    visibility: visible;
}

.popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.popup-content {
    position: relative;
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    z-index: 1;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.phoenix-form-popup.show .popup-content {
    transform: translateY(0);
}

.popup-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.success-popup .popup-icon {
    color: #4caf50;
}

.error-popup .popup-icon {
    color: #f44336;
}

.popup-message {
    margin-bottom: 20px;
    line-height: 1.6;
    font-size: 15px;
}

.popup-message strong {
    display: inline-block;
    color: #2196f3;
    font-size: 24px;
    margin: 10px 0;
    direction: ltr;
}

.popup-close {
    background: #4361ee;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.popup-close:hover {
    background: #3f37c9 !important;
    transform: translateY(-1px);
}

@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
