/* =========================================
   F-SKILL CUSTOM PROFILE MODAL
   LinkedIn-inspired premium modal design
   ========================================= */

/* Modal Base - Hidden by default */
.fskill-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    overflow: hidden;
}

.fskill-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Body state when modal is open */
body.fskill-modal-open {
    overflow: hidden;
}

/* Overlay with blur */
.fskill-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fskillFadeIn 0.2s ease;
}

/* Modal Container - Centers the dialog */
.fskill-modal-container {
    position: relative;
    z-index: 10001;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    margin: 20px;
    animation: fskillSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Modal Dialog Box */
.fskill-modal-dialog {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25),
        0 12px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: calc(90vh - 40px);
}

/* Header */
.fskill-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fc 100%);
    flex-shrink: 0;
}

.fskill-modal-title {
    margin: 0;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: #191919;
    letter-spacing: -0.01em;
}

.fskill-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.fskill-modal-close:hover {
    background: #e5e7eb;
    color: #374151;
    transform: rotate(90deg);
}

.fskill-modal-close svg {
    width: 20px;
    height: 20px;
}

/* Body */
.fskill-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Loading State */
.fskill-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    gap: 16px;
    color: #6b7280;
    font-size: 14px;
}

.fskill-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: #0a66c2;
    border-radius: 50%;
    animation: fskillSpin 0.8s linear infinite;
}

/* Content Area */
.fskill-modal-content {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Error Message */
.fskill-modal-error,
.fskill-form-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
    border: 1px solid #fecaca;
}

/* =========================================
   FORM STYLING INSIDE CUSTOM MODAL
   ========================================= */

.fskill-modal-content form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.fskill-modal-content .form-item {
    margin-bottom: 0 !important;
}

/* Labels */
.fskill-modal-content label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

.fskill-modal-content label.form-required::after {
    content: " *";
    color: #ef4444;
}

/* Inputs */
.fskill-modal-content input[type="text"],
.fskill-modal-content input[type="email"],
.fskill-modal-content input[type="url"],
.fskill-modal-content input[type="number"],
.fskill-modal-content input[type="date"],
.fskill-modal-content textarea,
.fskill-modal-content select {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: #191919;
    background: #ffffff;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.fskill-modal-content input:focus,
.fskill-modal-content textarea:focus,
.fskill-modal-content select:focus {
    outline: none;
    border-color: #0a66c2;
    box-shadow: 0 0 0 3px rgba(10, 102, 194, 0.12);
}

.fskill-modal-content textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.5;
}

/* Select with custom arrow */
.fskill-modal-content select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    cursor: pointer;
}

/* Descriptions */
.fskill-modal-content .description {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 6px;
    line-height: 1.5;
}

.fskill-modal-content .description a {
    color: #0a66c2;
    text-decoration: none;
}

/* File Upload */
.fskill-modal-content input[type="file"] {
    padding: 10px;
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    background: #f9fafb;
    cursor: pointer;
    width: 100%;
}

.fskill-modal-content input[type="file"]:hover {
    border-color: #0a66c2;
    background: rgba(10, 102, 194, 0.04);
}

/* Checkbox/Radio */
.fskill-modal-content input[type="checkbox"],
.fskill-modal-content input[type="radio"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    accent-color: #0a66c2;
    cursor: pointer;
}

/* Form Actions */
.fskill-modal-content .form-actions {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding-top: 20px;
    margin-top: 8px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Primary Button */
.fskill-modal-content .form-submit,
.fskill-modal-content button[type="submit"] {
    background: linear-gradient(135deg, #0a66c2 0%, #004182 100%);
    color: #ffffff;
    border: none;
    border-radius: 24px;
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(10, 102, 194, 0.25);
}

.fskill-modal-content .form-submit:hover,
.fskill-modal-content button[type="submit"]:hover {
    background: linear-gradient(135deg, #004182 0%, #002e5c 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(10, 102, 194, 0.35);
}

.fskill-modal-content .form-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Secondary/Cancel Button */
.fskill-modal-content .button:not(.form-submit) {
    background: #ffffff;
    color: #374151;
    border: 1.5px solid #d1d5db;
    border-radius: 24px;
    padding: 11px 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fskill-modal-content .button:not(.form-submit):hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* Hide Drupal clutter */
.fskill-modal-content .filter-wrapper,
.fskill-modal-content .filter-help,
.fskill-modal-content .filter-guidelines,
.fskill-modal-content .text-format-wrapper>.filter-wrapper,
.fskill-modal-content .form-type-textarea>.description:has(a[href*="filter/tips"]) {
    display: none !important;
}

/* Hide weight/order fields */
.fskill-modal-content .form-item-weight,
.fskill-modal-content .form-type-weight {
    display: none !important;
}

/* Fieldsets */
.fskill-modal-content fieldset,
.fskill-modal-content details {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    margin: 0;
    background: #fafafa;
}

.fskill-modal-content fieldset legend,
.fskill-modal-content details summary {
    font-weight: 600;
    font-size: 14px;
    color: #374151;
    padding: 0 8px;
}

/* Messages */
.fskill-modal-content .messages {
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 13px;
}

.fskill-modal-content .messages--error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.fskill-modal-content .messages--status {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
}

/* AJAX Loader */
.fskill-modal-content .ajax-progress {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.fskill-modal-content .ajax-progress .throbber {
    width: 18px;
    height: 18px;
    border: 2px solid #e5e7eb;
    border-top-color: #0a66c2;
    border-radius: 50%;
    animation: fskillSpin 0.8s linear infinite;
}

/* =========================================
   ANIMATIONS
   ========================================= */

@keyframes fskillFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fskillSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 600px) {
    .fskill-modal-container {
        margin: 16px;
        max-width: calc(100vw - 32px);
    }

    .fskill-modal-header {
        padding: 16px 20px;
    }

    .fskill-modal-body {
        padding: 20px;
    }

    .fskill-modal-content .form-actions {
        flex-direction: column;
    }

    .fskill-modal-content .form-submit,
    .fskill-modal-content .button {
        width: 100%;
        text-align: center;
    }
}

/* =========================================
   PROFILE EDIT MODAL FORMS
   ========================================= */

/* Modal Form Wrapper */
.fskill-modal-form {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Current Picture Preview */
.fskill-current-avatar,
.fskill-current-cover {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #f8f9fc;
    border-radius: 12px;
    margin-bottom: 20px;
}

.fskill-current-avatar img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.fskill-current-cover img {
    width: 100%;
    max-height: 150px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.fskill-current-avatar span,
.fskill-current-cover span {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

/* Form Help Text */
.fskill-form-help {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    color: #0369a1;
    line-height: 1.5;
}

.fskill-form-help strong {
    font-weight: 600;
}

/* Primary Button Style */
.fskill-btn-primary {
    background: linear-gradient(135deg, #0a66c2 0%, #004182 100%);
    color: #ffffff;
    border: none;
    border-radius: 24px;
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(10, 102, 194, 0.25);
}

.fskill-btn-primary:hover {
    background: linear-gradient(135deg, #004182 0%, #002e5c 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(10, 102, 194, 0.35);
}

/* Secondary Button Style */
.fskill-btn-secondary,
.dialog-cancel {
    background: #ffffff !important;
    color: #374151 !important;
    border: 1.5px solid #d1d5db !important;
    border-radius: 24px !important;
    padding: 11px 24px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fskill-btn-secondary:hover,
.dialog-cancel:hover {
    background: #f3f4f6 !important;
    border-color: #9ca3af !important;
}

/* Override Drupal default managed file styles */
.fskill-modal-form .js-form-managed-file {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 20px;
    background: #f9fafb;
    text-align: center;
}

.fskill-modal-form .js-form-managed-file:hover {
    border-color: #0a66c2;
    background: rgba(10, 102, 194, 0.04);
}

/* Drupal Dialog Specific Overrides */
.ui-dialog.ui-widget {
    border-radius: 16px !important;
    overflow: hidden !important;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25), 0 12px 40px rgba(0, 0, 0, 0.15) !important;
}

.ui-dialog .ui-dialog-titlebar {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fc 100%) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
    padding: 16px 20px !important;
}

.ui-dialog .ui-dialog-title {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #191919 !important;
}

.ui-dialog .ui-dialog-content {
    padding: 24px !important;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

.ui-dialog .ui-dialog-buttonpane {
    border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
    padding: 16px 20px !important;
    background: #fafafa !important;
}