/**
 * DxFormLayout Enhanced Styles
 * Global CSS for DevExpress form components
 * Provides consistent styling across all forms
 */

/* ========================================
   DxFormLayout Base Styles
   ======================================== */
.dxbl-form-layout-item {
    margin-bottom: 1rem;
}

.dxbl-form-layout-item-caption {
    font-weight: 500;
    color: #495057;
    font-size: 0.875rem;
}

/* Modern form layout for use with ModernFormCard */
.modern-form-layout {
    padding: 0;
}

/* Form item enhancements */
.form-item-enhanced {
    transition: all 0.2s ease;
}

/* ========================================
   Form Field Responsive Wrapper
   Mobile/Tablet: Vertical (label on top)
   Desktop: Horizontal (label on left)
   ======================================== */

.form-field-responsive {
    display: flex;
    margin-bottom: 0.05rem;
}

.form-field-input {
    width: 100%;
}

/* Mobile + Tablet (< 1280px): Vertical - Label üstte */
@media (max-width: 1279px) {
    .form-field-responsive {
        flex-direction: column;
        gap: 0.375rem;
    }

    .form-field-responsive .form-label-enhanced {
        text-align: left;
        margin-bottom: 0;
        font-size: 0.813rem;
    }

    .form-field-input {
        flex: 0 0 auto;
        width: auto;
    }
}

/* Desktop (>= 1280px): Horizontal - Label solda */
@media (min-width: 1280px) {
    .form-field-responsive {
        flex-direction: row;
        align-items: center;
        gap: 0.75rem;
    }

    /* Çoklu satır form elemanları için label üstte hizalı olmalı */
    .form-field-responsive.multiline-field {
        align-items: flex-start;
    }

    .form-field-responsive .form-label-enhanced {
        flex: 0 0 180px; /* Fixed 180px width for labels */
        text-align: left;
        margin-bottom: 0;
    }

    .form-field-input {
        flex: 1;
        min-width: 0;
    }
}

/* ========================================
   Enhanced Label Styles
   ======================================== */
.form-label-enhanced {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151; /* gray-700 */
    margin-bottom: 0.5rem;
    transition: color 0.2s ease;
}

.form-label-enhanced i {
    color: #3b82f6; /* blue-500 */
    margin-right: 0.5rem;
    font-size: 1rem;
}

/* ========================================
   Enhanced Input Styles
   Base styling for all DevExpress inputs
   ======================================== */

/* TextBox, ComboBox, Memo, Spin, Date, Time, Masked */
.enhanced-textbox .dx-texteditor,
.enhanced-combo .dx-texteditor,
.enhanced-memo .dx-texteditor,
.enhanced-spin .dx-texteditor,
.enhanced-date .dx-texteditor,
.enhanced-dateedit .dx-texteditor,
.enhanced-time .dx-texteditor,
.enhanced-masked .dx-texteditor {
    border-radius: 0.625rem; /* 10px */
    border: 1.5px solid #e2e8f0; /* slate-200 */
    transition: all 0.2s ease;
    background-color: #ffffff;
    font-size: 0.875rem;
}

/* Hover state */
.enhanced-textbox .dx-texteditor:hover,
.enhanced-combo .dx-texteditor:hover,
.enhanced-memo .dx-texteditor:hover,
.enhanced-spin .dx-texteditor:hover,
.enhanced-date .dx-texteditor:hover,
.enhanced-dateedit .dx-texteditor:hover,
.enhanced-time .dx-texteditor:hover,
.enhanced-masked .dx-texteditor:hover {
    border-color: #94a3b8; /* slate-400 */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Focus state - Orange theme (matches ModernFormCard) */
.enhanced-textbox .dx-texteditor:focus,
.enhanced-combo .dx-texteditor:focus,
.enhanced-memo .dx-texteditor:focus,
.enhanced-spin .dx-texteditor:focus,
.enhanced-date .dx-texteditor:focus,
.enhanced-dateedit .dx-texteditor:focus,
.enhanced-time .dx-texteditor:focus,
.enhanced-masked .dx-texteditor:focus {
    border-color: #f97316; /* orange-500 */
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
    outline: none;
}

/* Disabled state */
.enhanced-textbox .dx-texteditor-disabled,
.enhanced-combo .dx-texteditor-disabled,
.enhanced-memo .dx-texteditor-disabled,
.enhanced-spin .dx-texteditor-disabled,
.enhanced-date .dx-texteditor-disabled,
.enhanced-dateedit .dx-texteditor-disabled,
.enhanced-time .dx-texteditor-disabled,
.enhanced-masked .dx-texteditor-disabled {
    background-color: #f1f5f9; /* slate-100 */
    border-color: #e2e8f0;
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========================================
   CheckBox Enhanced Styles
   ======================================== */
.enhanced-checkbox .dxbl-checkbox {
    cursor: pointer;
    transition: all 0.2s ease;
}

.enhanced-checkbox .dxbl-checkbox-check {
    border-radius: 0.375rem;
    border: 1.5px solid #e2e8f0;
    transition: all 0.2s ease;
}

.enhanced-checkbox .dxbl-checkbox-check:hover {
    border-color: #f97316; /* orange-500 */
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.enhanced-checkbox .dxbl-checkbox-checked .dxbl-checkbox-check {
    background-color: #f97316; /* orange-500 */
    border-color: #f97316;
}

/* ========================================
   ListBox Enhanced Styles
   ======================================== */
.enhanced-listbox .dxbl-listbox {
    border-radius: 0.625rem;
    border: 1.5px solid #e2e8f0;
    transition: all 0.2s ease;
}

.enhanced-listbox .dxbl-listbox:hover {
    border-color: #94a3b8;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* ========================================
   Responsive Adjustments
   ======================================== */
@media (max-width: 768px) {
    .dxbl-form-layout-item {
        margin-bottom: 0.75rem;
    }

    .form-label-enhanced {
        font-size: 0.8125rem;
    }
}

/* ========================================
   Grid Layout Responsive
   Desktop 3-col → Tablet 2-col → Mobile 1-col
   Desktop 2-col → Tablet 2-col → Mobile 1-col
   ======================================== */

/* Mobile (< 768px): Her şey 1 sütun */
@media (max-width: 767px) {
    /* ColSpanMd="6" (2-column desktop) → 1 column mobile */
    .dxbl-form-layout-item[data-col-span-md="6"],
    /* ColSpanLg="4" (3-column desktop) → 1 column mobile */
    .dxbl-form-layout-item[data-col-span-lg="4"] {
        grid-column: span 12 !important;
    }
}

/* Tablet (768px - 1023px): 3-column desktop → 2-column tablet */
@media (min-width: 768px) and (max-width: 1023px) {
    /* ColSpanLg="4" (3-column desktop) → 2-column tablet */
    .dxbl-form-layout-item[data-col-span-lg="4"] {
        grid-column: span 6 !important;
    }
}

@media (max-width: 640px) {
    .dxbl-form-layout-item {
        margin-bottom: 0.5rem;
    }
}

/* ========================================
   Split-Screen Layout Responsive
   Desktop: Side-by-side forms
   Tablet/Mobile: Stacked vertically
   ======================================== */

/* Tablet ve Mobile (< 1024px): Dikey stack */
@media (max-width: 1023px) {
    /* Ana flex container'ı dikey yap (hem blz- prefixli hem prefixsiz) */
    .blz-flex.blz-w-full.blz-h-full.blz-gap-3,
    .flex.w-full.min-h-screen,
    .flex.w-full {
        flex-direction: column !important;
    }

    /* Tüm split-screen bölümleri tam genişlik yap */
    .blz-w-1\/2,
    .blz-w-7\/12,
    .blz-w-8\/12,
    .blz-w-2\/3,
    .blz-w-1\/3,
    .w-1\/2,
    .w-7\/12,
    .w-8\/12,
    .w-2\/3,
    .w-1\/3 {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Margin ayarlaması */
    .blz-ml-3,
    .ml-3 {
        margin-left: 0 !important;
        margin-top: 1rem;
    }

    /* Form yükseklik ayarlaması */
    .blz-h-full,
    .min-h-screen {
        height: auto !important;
        min-height: auto !important;
    }
}

/* Mobile (< 768px): Daha küçük padding/gap */
@media (max-width: 767px) {
    .blz-p-4,
    .p-4 {
        padding: 0.75rem !important;
    }

    .blz-gap-3,
    .gap-3 {
        gap: 0.75rem !important;
    }
}

/* ========================================
   Utility Classes
   ======================================== */

/* Fixed height for specific use cases */
.chi-220 {
    height: 220px;
}

.chi-180 {
    height: 180px;
}

.chi-280 {
    height: 280px;
}

/* Custom form label with fixed width (for horizontal layouts) */
.form-label-fixed {
    width: 140px;
    flex-shrink: 0;
}

/* ========================================
   Combo Box Dropdown Enhancements
   ======================================== */
.dxbl-combo-box-dropdown {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-radius: 0.625rem;
}

/* ========================================
   Spin Edit Button Styling
   ======================================== */
.dxbl-spin-edit-btn {
    border-color: #dee2e6;
}

/* ========================================
   Editor Focus Enhancements
   ======================================== */
.dxbl-edit:focus-within {
    box-shadow: 0 0 0 0.2rem rgba(249, 115, 22, 0.25); /* orange shadow */
}

/* ========================================
   FormFieldGroup Vertical Mode
   Compact styling when grouped fields use vertical labels
   ======================================== */
.form-field-group-vertical {
    flex-direction: column !important;
    margin-bottom: 1rem;
}

.form-field-group-vertical .form-label-enhanced {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    width: auto;
}

.form-field-group-vertical .form-field-input {
    padding-top: 0;
    margin-left: 0;
}

/* ========================================
   Year Switches Component
   ======================================== */
.form-field-input .year-switches-container,
.year-switches-container {
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 2rem !important;
    flex-wrap: wrap !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Tablet ekranlar için (769px - 1024px) */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .form-field-input .year-switches-container,
    .year-switches-container {
        display: flex !important;
        flex-direction: row !important;
        gap: 0.75rem !important;
        justify-content: flex-start !important;
        flex-wrap: wrap !important;
    }

    .form-field-input .year-switch-item,
    .year-switch-item {
        margin: 0 !important;
        padding: 0 !important;
    }

    .form-field-input .modern-switch,
    .modern-switch {
        width: 48px !important;
        height: 26px !important;
    }

    .form-field-input .modern-switch-slider:before,
    .modern-switch-slider:before {
        height: 20px !important;
        width: 20px !important;
    }

    .form-field-input .modern-switch input:checked + .modern-switch-slider:before,
    .modern-switch input:checked + .modern-switch-slider:before {
        transform: translateX(22px) !important;
    }
}

/* Geniş ekranlar için (1025px - 1200px) */
@media screen and (min-width: 1025px) and (max-width: 1200px) {
    .form-field-input .year-switches-container,
    .year-switches-container {
        gap: 1.5rem !important;
        justify-content: flex-start !important;
    }
}

.form-field-input .year-switch-item,
.year-switch-item {
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 0.5rem !important;
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
}

.form-field-input .year-label,
.year-label {
    display: inline-block !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    color: #475569 !important;
    margin: 0 !important;
    padding: 0 !important;
    white-space: nowrap !important;
}

/* ========================================
   Modern Switch Component
   ======================================== */
.modern-switch-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.25rem 0;
}

.modern-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    cursor: pointer;
}

.modern-switch.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modern-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.modern-switch input:disabled + .modern-switch-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.modern-switch-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
    user-select: none;
}

.modern-switch-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(145deg, #e2e8f0, #cbd5e1);
    border-radius: 28px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.modern-switch-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.modern-switch input:checked + .modern-switch-slider {
    background: linear-gradient(145deg, #3b82f6, #2563eb);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.modern-switch input:checked + .modern-switch-slider:before {
    transform: translateX(24px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.modern-switch:not(.disabled):hover .modern-switch-slider {
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.modern-switch input:checked:not(:disabled):hover + .modern-switch-slider {
    background: linear-gradient(145deg, #2563eb, #1d4ed8);
}

/* Mobil cihazlar için (max 768px) */
@media screen and (max-width: 768px) {
    .form-field-input .year-switches-container,
    .year-switches-container {
        display: flex !important;
        flex-direction: row !important;
        gap: 0.5rem !important;
        justify-content: flex-start !important;
        flex-wrap: wrap !important;
    }

    .form-field-input .year-switch-item,
    .year-switch-item {
        gap: 0.25rem !important;
        flex: 0 0 auto !important;
    }

    .form-field-input .year-label,
    .year-label {
        font-size: 0.75rem !important;
        font-weight: 600 !important;
    }

    .form-field-input .modern-switch,
    .modern-switch {
        width: 42px !important;
        height: 24px !important;
    }

    .form-field-input .modern-switch-slider:before,
    .modern-switch-slider:before {
        height: 18px !important;
        width: 18px !important;
        left: 3px !important;
        bottom: 3px !important;
    }

    .form-field-input .modern-switch input:checked + .modern-switch-slider:before,
    .modern-switch input:checked + .modern-switch-slider:before {
        transform: translateX(18px) !important;
    }
}

/* Extra small mobile devices - iPhone SE, etc */
@media screen and (max-width: 390px) {
    .form-field-input .year-switches-container,
    .year-switches-container {
        gap: 0.35rem !important;
    }

    .form-field-input .year-label,
    .year-label {
        font-size: 0.7rem !important;
    }

    .form-field-input .modern-switch,
    .modern-switch {
        width: 40px !important;
        height: 23px !important;
    }

    .form-field-input .modern-switch-slider:before,
    .modern-switch-slider:before {
        height: 17px !important;
        width: 17px !important;
    }

    .form-field-input .modern-switch input:checked + .modern-switch-slider:before,
    .modern-switch input:checked + .modern-switch-slider:before {
        transform: translateX(17px) !important;
    }
}

/* ========================================
   Empty State Component
   ======================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 50%, #f1f5f9 100%);
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.empty-state:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.empty-state i {
    font-size: 4rem;
    color: #94a3b8;
    margin-bottom: 1.5rem;
    animation: emptyStatePulse 2s ease-in-out infinite;
    opacity: 0.8;
}

@keyframes emptyStatePulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 0.9;
        transform: scale(1.05);
    }
}

.empty-state h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.75rem;
    letter-spacing: -0.01em;
}

.empty-state p {
    font-size: 0.9375rem;
    color: #64748b;
    margin: 0;
    max-width: 400px;
    line-height: 1.6;
}

/* ========================================
   Analysis Tabs Container
   ======================================== */
.analysis-tabs {
    width: 100%;
}

/* ========================================
   Enhanced Grid Styles
   ======================================== */
.enhanced-grid .e-grid {
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.enhanced-grid .e-gridheader {
    background: linear-gradient(to right, #f9fafb, #f3f4f6);
    border-bottom: 2px solid #10b981;
}

.enhanced-grid .e-headercell {
    font-weight: 600;
    color: #374151;
    padding: 12px;
}

.enhanced-grid .e-row:hover {
    background-color: #f0fdf4;
}

/* ========================================
   Enhanced Input for Blazor InputNumber
   ======================================== */
.enhanced-input {
    border-radius: 0.625rem;
    border: 1.5px solid #e2e8f0;
    transition: all 0.2s ease;
    background-color: #ffffff;
    padding: 0.5rem 0.75rem;
    width: 100%;
}

.enhanced-input:hover {
    border-color: #94a3b8;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.enhanced-input:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
    outline: none;
}

/* ========================================
   Mobile Responsive Padding Override
   ======================================== */
@media (max-width: 768px) {
    .blz-p-4 {
        padding: 0.5rem !important;
    }

    .blz-p-5 {
        padding: 0.75rem !important;
    }
}
