/* ================================================
   İLKSERVER - Modern Form Styles
   Apple & Stripe Inspired Design
   ================================================ */

/* ================================================
   CSS Variables - Light Theme (Default)
   ================================================ */
:root {
    --form-bg: #ffffff;
    --form-border: #d1d5db;
    --form-border-focus: #6366f1;
    --form-text: #1f2937;
    --form-text-light: #6b7280;
    --form-placeholder: #9ca3af;
    --form-success: #10b981;
    --form-error: #ef4444;
    --form-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    --form-shadow-focus: 0 0 0 3px rgba(99, 102, 241, 0.15);
    --form-radius: 12px;
    --form-padding: 14px 16px;
}

/* ================================================
   Toast Container
   ================================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    width: calc(100% - 40px);
}

@media (max-width: 480px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        width: auto;
    }
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 10px rgba(0, 0, 0, 0.1);
    animation: toastSlideIn 0.3s ease;
    border-left: 4px solid #6366f1;
}

.toast.success { border-left-color: #10b981; }
.toast.error { border-left-color: #ef4444; }
.toast.warning { border-left-color: #f59e0b; }

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

.toast.removing {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideOut {
    to { opacity: 0; transform: translateX(100%); }
}

.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.toast.success .toast-icon { color: #10b981; }
.toast.error .toast-icon { color: #ef4444; }
.toast.warning .toast-icon { color: #f59e0b; }
.toast.info .toast-icon { color: #6366f1; }

.toast-content { flex: 1; }

.toast-title {
    font-weight: 600;
    font-size: 15px;
    color: #1f2937;
    margin-bottom: 4px;
}

.toast-message {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.4;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #9ca3af;
    border-radius: 6px;
    transition: all 0.2s;
}

.toast-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

/* ================================================
   Modal Styles
   ================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active,
.modal-overlay[style*="flex"] {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-container,
.modal-overlay[style*="flex"] .modal-container {
    transform: scale(1) translateY(0);
}

@media (max-width: 640px) {
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }
    
    .modal-container {
        max-height: 95vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
    }
    
    .modal-overlay.active .modal-container,
    .modal-overlay[style*="flex"] .modal-container {
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #1f2937;
    border-color: #d1d5db;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
    .modal-body {
        max-height: calc(95vh - 80px);
    }
}

/* ================================================
   Form Base Styles
   ================================================ */
.modern-form,
.proposal-form,
.contact-form {
    width: 100%;
}

/* Form Row - Grid Layout */
.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

@media (min-width: 640px) {
    .form-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* Form Group */
.form-group {
    position: relative;
    margin-bottom: 16px;
}

.form-row .form-group {
    margin-bottom: 0;
}

/* Labels */
.form-label,
.form-group > label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.form-label .required,
.form-group > label .required {
    color: #ef4444;
    margin-left: 2px;
}

.form-label .optional,
.form-group > label .optional {
    font-weight: 400;
    color: #9ca3af;
    font-size: 12px;
}

/* Input Styles */
.form-input,
.form-control {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    font-family: inherit;
    line-height: 1.5;
    color: #1f2937;
    background-color: #ffffff;
    border: 1.5px solid #d1d5db;
    border-radius: 12px;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:hover,
.form-control:hover {
    border-color: #9ca3af;
}

.form-input:focus,
.form-control:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-input::placeholder,
.form-control::placeholder {
    color: #9ca3af;
}

/* Input with Icon */
.input-with-icon {
    position: relative;
}

.input-with-icon .form-input {
    padding-left: 48px;
}

.input-with-icon .input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #9ca3af;
    pointer-events: none;
    transition: color 0.2s;
}

.input-with-icon:focus-within .input-icon {
    color: #6366f1;
}

/* Validation Icons */
.validation-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    opacity: 0;
    transition: opacity 0.2s;
}

.validation-icon.success-icon { color: #10b981; }
.validation-icon.error-icon { color: #ef4444; }

.form-group.has-success .validation-icon.success-icon { opacity: 1; }
.form-group.has-error .validation-icon.error-icon { opacity: 1; }

/* Validation States */
.form-group.has-success .form-input,
.form-group.has-success .form-control {
    border-color: #10b981;
    background-color: rgba(16, 185, 129, 0.05);
}

.form-group.has-error .form-input,
.form-group.has-error .form-control {
    border-color: #ef4444;
    background-color: rgba(239, 68, 68, 0.05);
}

/* Error Message */
.error-message {
    display: none;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 13px;
    color: #ef4444;
}

.form-group.has-error .error-message {
    display: flex;
}

.error-message svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Select Dropdown */
select.form-input,
select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 20px;
    padding-right: 48px;
}

/* Textarea */
textarea.form-input,
textarea.form-control {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

/* Character Counter */
.char-counter {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
    font-size: 12px;
    color: #9ca3af;
}

.char-counter.warning { color: #f59e0b; }
.char-counter.error { color: #ef4444; }

/* Helper Text */
.helper-text {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #9ca3af;
}

/* ================================================
   Button Styles
   ================================================ */
.form-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

@media (min-width: 640px) {
    .form-actions {
        flex-direction: row;
        justify-content: flex-end;
    }
}

.btn-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: #ffffff;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

@media (min-width: 640px) {
    .btn-submit {
        width: auto;
        min-width: 160px;
    }
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.btn-submit:active:not(:disabled) {
    transform: translateY(0);
}

.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-submit.loading {
    color: transparent;
    pointer-events: none;
}

.btn-submit.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.btn-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    color: #6b7280;
    background: #f3f4f6;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

@media (min-width: 640px) {
    .btn-cancel {
        width: auto;
        min-width: 120px;
    }
}

.btn-cancel:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    color: #374151;
}

/* ================================================
   Form Messages
   ================================================ */
.form-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.form-message.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #047857;
}

.form-message.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #dc2626;
}

.form-message svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* ================================================
   Honeypot (Spam Protection)
   ================================================ */
.honeypot {
    position: absolute !important;
    left: -9999px !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    pointer-events: none !important;
}

/* ================================================
   Contact Form Specific (iletisim.php)
   ================================================ */
.contact-form-section .form-input,
.contact-form-section .form-control,
.contact-form .form-input,
.contact-form .form-control {
    background-color: #ffffff;
    color: #1f2937;
    border-color: #d1d5db;
}

.contact-form-section .form-label,
.contact-form-section .form-group > label,
.contact-form .form-label,
.contact-form .form-group > label {
    color: #374151;
}

.contact-form-section .input-icon,
.contact-form .input-icon {
    color: #9ca3af;
}

/* ================================================
   Dark Background Support (for modals on dark pages)
   ================================================ */
.modal-body .form-input,
.modal-body .form-control {
    background-color: #ffffff;
    color: #1f2937;
    border-color: #d1d5db;
}

.modal-body .form-input:focus,
.modal-body .form-control:focus {
    border-color: #6366f1;
    background-color: #ffffff;
}

.modal-body .form-label,
.modal-body .form-group > label {
    color: #374151;
}

/* ================================================
   Mobile Optimizations
   ================================================ */
@media (max-width: 640px) {
    .form-input,
    .form-control {
        font-size: 16px; /* Prevents iOS zoom */
        padding: 16px;
    }
    
    .input-with-icon .form-input {
        padding-left: 48px;
    }
    
    textarea.form-input,
    textarea.form-control {
        min-height: 140px;
    }
    
    .form-row {
        gap: 12px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-header {
        padding: 16px 20px;
    }
}

/* ================================================
   Print Styles
   ================================================ */
@media print {
    .modal-overlay,
    .toast-container {
        display: none !important;
    }
}
