/* =================================
------------------------------------
  TIYEMDER - Admin Forms CSS
------------------------------------
====================================*/

/* ===== FORM CONTAINERS ===== */
.form-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid #e9ecef;
}

.form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f8f9fa;
}

.form-title {
    color: #0E2062;
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-title i {
    color: #3498db;
    font-size: 1.5rem;
}

.form-actions {
    display: flex;
    gap: 10px;
}

/* ===== FORM GROUPS ===== */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: inline-block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--admin-gray-700);
}

.form-group label.required::after {
    content: '*';
    color: #e74c3c;
    margin-left: 5px;
    font-size: 1.1rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--admin-dark);
    background-color: var(--admin-white);
    background-clip: padding-box;
    border: 1px solid var(--admin-gray-300);
    border-radius: var(--admin-border-radius);
    transition: var(--admin-transition);
}

.form-control:focus {
    color: var(--admin-dark);
    background-color: var(--admin-white);
    border-color: var(--admin-primary);
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgb(67 97 238 / 25%);
}

.form-control:invalid {
    border-color: #e74c3c;
}

.form-control::placeholder {
    color: var(--admin-gray-500);
    opacity: 1;
}

.form-control:disabled,
.form-control[readonly] {
    background-color: var(--admin-gray-100);
    opacity: 1;
}

/* ===== TEXTAREA ===== */
textarea.form-control {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.6;
}

/* ===== SELECT ELEMENTS ===== */
select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 45px;
    appearance: none;
}

/* ===== FILE INPUTS ===== */
.file-input-wrapper {
    position: relative;
    overflow: hidden;
    border: 2px dashed #bdc3c7;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    transition: all 0.3s ease;
    background: #f8f9fa;
    cursor: pointer;
}

.file-input-wrapper:hover {
    border-color: #3498db;
    background: #f0f8ff;
}

.file-input-wrapper.dragover {
    border-color: #2ecc71;
    background: #f0fff4;
}

.file-input {
    position: absolute;
    left: -9999px;
    opacity: 0;
}

.file-input-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: #7f8c8d;
    font-weight: 500;
}

.file-input-label i {
    font-size: 3rem;
    color: #bdc3c7;
    transition: color 0.3s ease;
}

.file-input-wrapper:hover .file-input-label i {
    color: #3498db;
}

.file-preview {
    margin-top: 15px;
    text-align: center;
}

.file-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.file-info {
    margin-top: 10px;
    padding: 10px;
    background: #e8f5e8;
    border-radius: 6px;
    color: #27ae60;
    font-weight: 500;
    font-size: 0.9rem;
}

/* ===== CHECKBOXES & RADIO BUTTONS ===== */
.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    cursor: pointer;
}

.form-check-input {
    width: 18px;
    height: 18px;
    border: 2px solid #bdc3c7;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.form-check-input[type="radio"] {
    border-radius: 50%;
}

.form-check-input:checked {
    background: #3498db;
    border-color: #3498db;
}

.form-check-input:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.form-check-input[type="radio"]:checked::after {
    top: 3px;
    left: 3px;
    width: 8px;
    height: 8px;
    border: none;
    border-radius: 50%;
    background: #fff;
    transform: none;
}

.form-check-label {
    color: #2c3e50;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

/* ===== FORM VALIDATION ===== */
.form-group.has-error .form-control {
    border-color: #e74c3c;
    background: #fdf2f2;
}

.form-group.has-success .form-control {
    border-color: #27ae60;
    background: #f1f8f4;
}

.error-message {
    color: #e74c3c;
    font-size: 0.85rem;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.error-message i {
    font-size: 0.8rem;
}

.success-message {
    color: #27ae60;
    font-size: 0.85rem;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.success-message i {
    font-size: 0.8rem;
}

/* ===== FORM BUTTONS ===== */
.form-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
    min-width: 120px;
    justify-content: center;
}

.btn i {
    font-size: 0.9rem;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: #fff;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2980b9, #1f618d);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(52, 152, 219, 0.4);
    color: #fff;
    text-decoration: none;
}

.btn-success {
    background: linear-gradient(135deg, #27ae60, #229954);
    color: #fff;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #229954, #1e8449);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(39, 174, 96, 0.4);
    color: #fff;
    text-decoration: none;
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: #fff;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c0392b, #922b21);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(231, 76, 60, 0.4);
    color: #fff;
    text-decoration: none;
}

.btn-secondary {
    background: #95a5a6;
    color: #fff;
    box-shadow: 0 4px 12px rgba(149, 165, 166, 0.3);
}

.btn-secondary:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(149, 165, 166, 0.4);
    color: #fff;
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    border: 2px solid #3498db;
    color: #3498db;
}

.btn-outline:hover {
    background: #3498db;
    color: #fff;
    text-decoration: none;
}

/* ===== FORM GRID ===== */
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
}

.form-col {
    flex: 1;
}

.form-col-3 {
    flex: 0 0 25%;
}

.form-col-6 {
    flex: 0 0 50%;
}

.form-col-9 {
    flex: 0 0 75%;
}

/* ===== EDITOR INTEGRATION ===== */
.editor-container {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

.editor-container:focus-within {
    border-color: #3498db;
}

.ck-editor__editable {
    min-height: 300px;
    padding: 20px;
    font-size: 1rem;
    line-height: 1.6;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .form-container {
        padding: 20px;
        margin: 15px;
    }
    
    .form-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .form-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .form-col,
    .form-col-3,
    .form-col-6,
    .form-col-9 {
        flex: none;
        width: 100%;
    }
    
    .form-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn {
        width: 100%;
    }
    
    .file-input-wrapper {
        padding: 20px;
    }
    
    .file-input-label i {
        font-size: 2rem;
    }
}

@media (max-width: 576px) {
    .form-title {
        font-size: 1.5rem;
    }
    
    .form-control {
        padding: 10px 12px;
        font-size: 0.95rem;
    }
    
    .btn {
        padding: 10px 15px;
        font-size: 0.9rem;
        min-width: 100px;
    }
}

/* ===== LOADING STATES ===== */
.btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: button-loading-spinner 1s ease infinite;
    margin-left: 8px;
}

@keyframes button-loading-spinner {
    from {
        transform: rotate(0turn);
    }
    to {
        transform: rotate(1turn);
    }
}

/* ===== FORM TABS ===== */
.form-tabs {
    display: flex;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 30px;
}

.form-tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: #7f8c8d;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.form-tab.active {
    color: #3498db;
    border-bottom-color: #3498db;
}

.form-tab:hover {
    color: #2c3e50;
    background: #f8f9fa;
}

.form-tab-content {
    display: none;
}

.form-tab-content.active {
    display: block;
}

/* ===== HELP TEXT ===== */
.form-help {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-top: 5px;
    font-style: italic;
}

.form-help i {
    margin-right: 5px;
    color: #3498db;
}

/* ===== PROGRESS INDICATOR ===== */
.form-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    padding: 0 20px;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.progress-step::after {
    content: '';
    position: absolute;
    top: 15px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: #e9ecef;
    z-index: 1;
}

.progress-step:last-child::after {
    display: none;
}

.progress-step.completed::after {
    background: #27ae60;
}

.progress-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e9ecef;
    color: #7f8c8d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    z-index: 2;
    position: relative;
    margin-bottom: 8px;
}

.progress-step.completed .progress-number {
    background: #27ae60;
    color: #fff;
}

.progress-step.active .progress-number {
    background: #3498db;
    color: #fff;
}

.progress-label {
    font-size: 0.85rem;
    color: #7f8c8d;
    font-weight: 500;
    text-align: center;
}

.progress-step.active .progress-label {
    color: #3498db;
}

.progress-step.completed .progress-label {
    color: #27ae60;
}

/* Media Browser */
.media-browser {
  cursor: pointer;
}

.media-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.media-item {
  border-radius: var(--admin-border-radius);
  overflow: hidden;
  box-shadow: var(--admin-box-shadow);
  transition: var(--admin-transition);
}

.media-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--admin-box-shadow-lg);
}

.media-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
}

.media-item-actions {
  padding: 10px;
  display: flex;
  justify-content: center;
}

.select-media {
  width: 100%;
  padding: 8px;
  background: var(--admin-primary);
  color: white;
  border: none;
  border-radius: var(--admin-border-radius);
  cursor: pointer;
  transition: var(--admin-transition);
}

.select-media:hover {
  background: var(--admin-primary-dark);
}