/* ========================================
   MODERN FORM STYLES - Outreachist
   Global form styling for the entire application
   Theme-aware: Uses CSS variables for colors
   ======================================== */

/* Base input styles - NO color forcing, let inline styles work */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="month"],
input[type="week"],
select,
textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
input[type="time"]:focus,
input[type="month"]:focus,
input[type="week"]:focus,
select:focus,
textarea:focus {
    border-color: #ef4444;
    outline: none;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: #9ca3af;
    opacity: 1;
}

/* Autofill - preserve background, just prevent yellow */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    transition: background-color 5000s ease-in-out 0s;
}

/* Textarea specific */
textarea {
    resize: vertical;
    min-height: 100px;
}

/* Select styling */
select {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    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='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") !important;
    background-position: right 0.75rem center !important;
    background-repeat: no-repeat !important;
    background-size: 1.25em 1.25em !important;
    padding-right: 2.5rem !important;
}

/* Fix select arrow in dark mode */
select::-ms-expand {
    display: none !important;
}

/* Ensure select has proper styling in all themes */
.select-styled {
    position: relative;
}

.select-styled select {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: none !important;
    padding-right: 2.5rem !important;
}

.select-styled::after {
    content: '';
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3e%3c/svg%3e");
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
}

/* Checkbox styles - SQUARE (no border-radius) - FORCED */
input[type="checkbox"],
input[type="checkbox"]:not(.toggle),
input[type="checkbox"]:not([role="switch"]) {
    width: 1.25rem !important;
    height: 1.25rem !important;
    min-width: 1.25rem !important;
    min-height: 1.25rem !important;
    max-width: 1.25rem !important;
    max-height: 1.25rem !important;
    border: 2px solid #d1d5db !important;
    border-radius: 0 !important; /* KARE - dikdörtgen/yuvarlak ASLA */
    background-color: #ffffff !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    flex-shrink: 0 !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: inline-block !important;
    vertical-align: middle !important;
    box-sizing: border-box !important;
}

input[type="checkbox"]:checked {
    background-color: #ef4444 !important;
    border-color: #ef4444 !important;
    border-radius: 0 !important;
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e") !important;
    background-size: 100% 100% !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

/* Radio styles - Default visible radio buttons */
input[type="radio"] {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    background-color: #ffffff;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

input[type="radio"]:checked {
    background-color: #ffffff;
    border-color: #ef4444;
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='%23ef4444' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='4'/%3e%3c/svg%3e");
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
}

input[type="radio"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

/* IMPORTANT: Hide radio buttons with sr-only class completely */
input[type="radio"].sr-only,
input[type="checkbox"].sr-only,
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Hide peer radio/checkbox inputs */
input.peer.sr-only,
input[type="radio"].peer,
input[type="checkbox"].peer {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Label styles */
label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

label.inline {
    display: inline-flex;
    align-items: center;
    margin-bottom: 0;
}

/* Form group wrapper */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

/* Input with icon */
.input-with-icon {
    position: relative;
}

.input-with-icon input,
.input-with-icon select {
    padding-left: 2.75rem;
}

.input-with-icon .input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}

/* Input helper text */
.input-help {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

.input-help svg {
    width: 0.875rem;
    height: 0.875rem;
    flex-shrink: 0;
}

/* Input error state */
.input-error input,
.input-error select,
.input-error textarea {
    border-color: #ef4444;
    background-color: #fef2f2;
}

.input-error input:focus,
.input-error select:focus,
.input-error textarea:focus {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
}

.error-message {
    font-size: 0.75rem;
    color: #ef4444;
    margin-top: 0.375rem;
}

/* Input success state */
.input-success input,
.input-success select,
.input-success textarea {
    border-color: #10b981;
    background-color: #f0fdf4;
}

/* Modern card styling for forms */
.form-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    border: 1px solid #f3f4f6;
    overflow: hidden;
}

.form-card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f3f4f6;
    background: linear-gradient(to right, #f9fafb, #ffffff);
}

.form-card-header h2,
.form-card-header h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.form-card-header .header-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-card-header .header-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.form-card-body {
    padding: 1.5rem;
}

/* Button styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: 0.75rem;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(to right, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(to right, #dc2626, #b91c1c);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #374151;
    color: white;
}

.btn-secondary:hover {
    background-color: #1f2937;
}

.btn-outline {
    background-color: transparent;
    border-color: #e5e7eb;
    color: #374151;
}

.btn-outline:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

.btn-success {
    background-color: #10b981;
    color: white;
}

.btn-success:hover {
    background-color: #059669;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

/* Tag/pill input container */
.tag-input-container {
    min-height: 80px;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(239, 246, 255, 0.5), #f9fafb);
    border: 2px dashed #e5e7eb;
    border-radius: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-start;
    align-content: flex-start;
}

.tag-input-container.blue {
    background: linear-gradient(135deg, rgba(219, 234, 254, 0.5), #f9fafb);
    border-color: #bfdbfe;
}

.tag-input-container.green {
    background: linear-gradient(135deg, rgba(209, 250, 229, 0.5), #f9fafb);
    border-color: #a7f3d0;
}

.tag-input-container.purple {
    background: linear-gradient(135deg, rgba(237, 233, 254, 0.5), #f9fafb);
    border-color: #ddd6fe;
}

/* Tags */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    animation: fadeIn 0.2s ease;
}

.tag-blue {
    background-color: #dbeafe;
    color: #1e40af;
}

.tag-green {
    background-color: #d1fae5;
    color: #065f46;
}

.tag-purple {
    background-color: #ede9fe;
    color: #5b21b6;
}

.tag-orange {
    background-color: #ffedd5;
    color: #c2410c;
}

.tag-red {
    background-color: #fee2e2;
    color: #991b1b;
}

.tag button {
    padding: 0.125rem;
    border-radius: 9999px;
    transition: background-color 0.15s;
    background: transparent;
    border: none;
    cursor: pointer;
}

.tag button:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Checkbox list container */
.checkbox-list {
    background: linear-gradient(135deg, #f9fafb, #ffffff);
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 0.5rem;
    max-height: 16rem;
    overflow-y: auto;
}

.checkbox-list label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.15s;
    margin-bottom: 0;
    font-weight: 500;
}

.checkbox-list label:hover {
    background-color: #f3f4f6;
}

.checkbox-list label span {
    font-size: 0.875rem;
    color: #374151;
}

/* Scrollbar styling */
.checkbox-list::-webkit-scrollbar,
.overflow-y-auto::-webkit-scrollbar {
    width: 6px;
}

.checkbox-list::-webkit-scrollbar-track,
.overflow-y-auto::-webkit-scrollbar-track {
    background: transparent;
}

.checkbox-list::-webkit-scrollbar-thumb,
.overflow-y-auto::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.checkbox-list::-webkit-scrollbar-thumb:hover,
.overflow-y-auto::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Selection cards (like status selection) */
.selection-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.selection-card:hover {
    border-color: #d1d5db;
    background-color: #f9fafb;
}

.selection-card.selected,
.selection-card:has(input:checked) {
    border-color: #ef4444;
    background-color: #fef2f2;
}

.selection-card input[type="radio"],
.selection-card input[type="checkbox"] {
    margin-top: 0.125rem;
}

.selection-card .card-content {
    margin-left: 0.75rem;
}

.selection-card .card-title {
    font-weight: 600;
    color: #111827;
    margin-bottom: 0;
}

.selection-card .card-description {
    font-size: 0.875rem;
    color: #6b7280;
}

/* Sticky form actions */
.form-actions-sticky {
    position: sticky;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-radius: 1rem;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #f3f4f6;
    padding: 1rem 1.5rem;
    margin-top: 1.5rem;
}

/* Badge/limit indicators */
.limit-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.limit-badge-purple {
    background-color: #f3e8ff;
    color: #7c3aed;
}

.limit-badge-green {
    background-color: #d1fae5;
    color: #059669;
}

.limit-badge-orange {
    background-color: #ffedd5;
    color: #ea580c;
}

.limit-badge-blue {
    background-color: #dbeafe;
    color: #2563eb;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.95); }
}

.animate-fadeIn {
    animation: fadeIn 0.2s ease forwards;
}

.animate-fadeOut {
    animation: fadeOut 0.15s ease forwards;
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    color: white;
    font-weight: 500;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: fadeIn 0.2s ease;
}

.toast-success { background-color: #10b981; }
.toast-error { background-color: #ef4444; }
.toast-warning { background-color: #f59e0b; }
.toast-info { background-color: #3b82f6; }

/* File input styling */
input[type="file"] {
    width: 100%;
    padding: 0.75rem;
    background-color: #f9fafb;
    border: 2px dashed #e5e7eb;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="file"]:hover {
    border-color: #d1d5db;
    background-color: #f3f4f6;
}

input[type="file"]:focus {
    outline: none;
    border-color: #ef4444;
    background-color: #ffffff;
}

/* Range slider */
input[type="range"] {
    width: 100%;
    height: 0.5rem;
    background: #e5e7eb;
    border-radius: 9999px;
    appearance: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    background: #ef4444;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

/* Disabled state */
input:disabled,
select:disabled,
textarea:disabled {
    background-color: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Read-only state */
input:read-only,
textarea:read-only {
    background-color: #f9fafb;
    border-color: #e5e7eb;
    cursor: default;
}

input:read-only:focus,
textarea:read-only:focus {
    border-color: #e5e7eb;
    box-shadow: none;
}

/* Section divider */
.section-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
    color: #9ca3af;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.section-divider::before,
.section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

/* Form row for inline fields */
.form-row {
    display: grid;
    gap: 1.5rem;
}

.form-row-2 { grid-template-columns: repeat(2, 1fr); }
.form-row-3 { grid-template-columns: repeat(3, 1fr); }
.form-row-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .form-row-2,
    .form-row-3,
    .form-row-4 {
        grid-template-columns: 1fr;
    }
}

/* Color variants for different sections */
.input-blue:focus { border-color: #3b82f6 !important; box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1) !important; }
.input-green:focus { border-color: #10b981 !important; box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1) !important; }
.input-purple:focus { border-color: #8b5cf6 !important; box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1) !important; }
.input-orange:focus { border-color: #f97316 !important; box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.1) !important; }

/* Input sizes */
.input-sm {
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
}

.input-lg {
    padding: 1rem 1.25rem;
    font-size: 1rem;
}

/* Special password field with toggle */
.password-field {
    position: relative;
}

.password-field input {
    padding-right: 3rem;
}

.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.25rem;
}

.password-toggle:hover {
    color: #6b7280;
}

/* Login/Auth specific styles */
.auth-form input {
    font-size: 1rem;
}

.auth-form .btn {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
}

/* Social login buttons */
.btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem 1.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    background: white;
    font-weight: 600;
    color: #374151;
    transition: all 0.2s ease;
}

.btn-social:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

.btn-social img {
    width: 1.25rem;
    height: 1.25rem;
}

/* Table filter inputs */
.table-filter input,
.table-filter select {
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
}

/* Search bar style */
.search-bar {
    position: relative;
}

.search-bar input {
    padding-left: 2.75rem;
    padding-right: 0.875rem;
}

.search-bar .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}

/* Modal form styles */
.modal-form {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

/* Inline edit form */
.inline-edit {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.inline-edit input {
    flex: 1;
    padding: 0.5rem 0.75rem;
}

.inline-edit button {
    padding: 0.5rem;
    border-radius: 0.5rem;
}
