/* Professional Forms Styling for Hospital Management System */

/* Form Container Styles */
.form-container {
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(230, 230, 230, 0.5);
    position: relative;
    overflow: hidden;
}

.form-container::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.05) 0%, transparent 70%);
    animation: pulse 15s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.3;
    }
}

/* Form Headers */
.form-header {
    margin-bottom: 32px;
    position: relative;
    z-index: 1;
}

.form-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
    position: relative;
    display: inline-block;
}

.form-header h3::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 2px;
}

.form-header p {
    color: #64748b;
    font-size: 0.95rem;
    margin-top: 12px;
}

/* Form Groups */
.form-group {
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

.form-group.required label::after {
    content: ' *';
    color: #ef4444;
    font-weight: 700;
}

/* Enhanced Input Fields */
.form-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    background: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.form-input:hover {
    border-color: #cbd5e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1), 0 4px 12px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.form-input:disabled {
    background-color: #f8fafc;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Floating Labels */
.floating-label {
    position: relative;
}

.floating-label input,
.floating-label select,
.floating-label textarea {
    padding-top: 20px;
    padding-bottom: 8px;
}

.floating-label label {
    position: absolute;
    top: 50%;
    left: 18px;
    transform: translateY(-50%);
    transition: all 0.3s ease;
    pointer-events: none;
    color: #94a3b8;
    font-size: 1rem;
    background: white;
    padding: 0 6px;
}

.floating-label input:focus + label,
.floating-label input:not(:placeholder-shown) + label,
.floating-label select:focus + label,
.floating-label select:valid + label,
.floating-label textarea:focus + label,
.floating-label textarea:not(:placeholder-shown) + label {
    top: 0;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: #3b82f6;
    font-weight: 600;
}

/* Select Dropdowns with Custom Arrow */
.select-wrapper {
    position: relative;
}

.select-wrapper select {
    appearance: none;
    padding-right: 48px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 24px;
}

.select-wrapper select:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%233b82f6'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
}

/* Textarea with Auto-resize */
textarea.form-input {
    min-height: 120px;
    resize: vertical;
}

/* Radio Buttons and Checkboxes */
.custom-control {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    cursor: pointer;
    position: relative;
    padding-left: 32px;
    user-select: none;
}

.custom-control input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.custom-control-indicator {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 20px;
    width: 20px;
    background-color: white;
    border: 2px solid #e2e8f0;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.custom-control input[type="radio"] ~ .custom-control-indicator {
    border-radius: 50%;
}

.custom-control:hover .custom-control-indicator {
    border-color: #cbd5e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.custom-control input:checked ~ .custom-control-indicator {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

.custom-control input:checked ~ .custom-control-indicator::after {
    content: '';
    position: absolute;
    display: block;
}

.custom-control input[type="checkbox"]:checked ~ .custom-control-indicator::after {
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.custom-control input[type="radio"]:checked ~ .custom-control-indicator::after {
    left: 5px;
    top: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}

/* Toggle Switches */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e2e8f0;
    transition: all 0.4s ease;
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: all 0.4s ease;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #3b82f6;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(28px);
}

/* Form Buttons */
.form-buttons {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 14px 32px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.35);
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.btn-secondary {
    background: white;
    color: #64748b;
    padding: 14px 32px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    border: 2px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Input Groups */
.input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.input-group-prepend,
.input-group-append {
    display: flex;
    align-items: center;
    padding: 0 16px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    color: #64748b;
    font-weight: 500;
}

.input-group-prepend {
    border-right: none;
    border-radius: 12px 0 0 12px;
}

.input-group-append {
    border-left: none;
    border-radius: 0 12px 12px 0;
}

.input-group input {
    border-radius: 0;
}

.input-group input:focus {
    z-index: 1;
}

.input-group-prepend + input {
    border-left: none;
}

input + .input-group-append {
    border-left: none;
}

/* Form Validation States */
.form-group.has-error .form-input {
    border-color: #ef4444;
}

.form-group.has-error .form-input:focus {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.form-group.has-success .form-input {
    border-color: #10b981;
}

.form-group.has-success .form-input:focus {
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.form-error {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-error::before {
    content: '⚠';
    font-size: 1rem;
}

.form-success {
    color: #10b981;
    font-size: 0.875rem;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-success::before {
    content: '✓';
    font-size: 1rem;
}

/* Form Progress Indicator */
.form-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 32px;
    position: relative;
}

.form-progress::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: #e2e8f0;
    z-index: 0;
}

.form-progress-step {
    position: relative;
    z-index: 1;
    text-align: center;
}

.form-progress-step-indicator {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.form-progress-step.active .form-progress-step-indicator {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.form-progress-step.completed .form-progress-step-indicator {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.form-progress-step-label {
    font-size: 0.875rem;
    color: #94a3b8;
    font-weight: 500;
}

.form-progress-step.active .form-progress-step-label {
    color: #3b82f6;
    font-weight: 600;
}

/* Loading States */
.form-loading {
    position: relative;
    pointer-events: none;
}

.form-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    z-index: 10;
}

.form-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f4f6;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 11;
}

/* Responsive Design */
@media (max-width: 768px) {
    .form-container {
        padding: 24px 16px;
    }
    
    .form-buttons {
        flex-direction: column;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .input-group-prepend,
    .input-group-append {
        width: 100%;
        border-radius: 12px 12px 0 0;
        border-right: 2px solid #e2e8f0;
        border-bottom: none;
    }
    
    .input-group-append {
        border-radius: 0 0 12px 12px;
        border-top: none;
        border-left: 2px solid #e2e8f0;
    }
    
    .input-group input {
        border-radius: 0;
        border: 2px solid #e2e8f0;
        border-top: none;
        border-bottom: none;
    }
}
