.page {
    display: none;
}
.page.active {
    display: block;
}
.fade-in {
    animation: fadeIn 0.3s ease-in;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
    from { 
        opacity: 0; 
        transform: translateY(30px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}
.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}
.animate-slide-up {
    animation: slideUp 0.6s ease-out;
}
.animate-slide-up-delay {
    animation: slideUp 0.8s ease-out 0.2s both;
}
.error-message {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}
/* Select elementinin koyu tema desteği */
select option {
    background-color: white;
    color: #1e293b;
}
.dark select option {
    background-color: #1e293b !important;
    color: white !important;
}
select:focus option {
    background-color: #1e293b !important;
    color: white !important;
}
.dark select:focus option {
    background-color: #1e293b !important;
    color: white !important;
}
select:active option {
    background-color: #1e293b !important;
    color: white !important;
}
.dark select:active option {
    background-color: #1e293b !important;
    color: white !important;
}
/* Select elementinin açık durumda koyu tema */
select:focus {
    background-color: #1e293b !important;
    color: white !important;
}
.dark select:focus {
    background-color: #1e293b !important;
    color: white !important;
}
select:active {
    background-color: #1e293b !important;
    color: white !important;
}
.dark select:active {
    background-color: #1e293b !important;
    color: white !important;
}
/* Silme Modalı */
#delete-modal {
    display: none;
}
#delete-modal.show {
    display: flex;
}
/* Toplu Silme Modalı */
#delete-selected-modal {
    display: none;
}
#delete-selected-modal.show {
    display: flex;
}
/* Stok Uyarı Modalı */
#stock-warning-modal {
    display: none;
}
#stock-warning-modal.show {
    display: flex;
}
/* Stok Kayıt Başarı Modalı */
#stock-save-modal {
    display: none;
}
#stock-save-modal.show {
    display: flex;
}
#reset-birim-fiyat-modal {
    display: none;
}
#reset-birim-fiyat-modal.show {
    display: flex;
}
#exit-modal {
    display: none;
}
#exit-modal.show {
    display: flex;
}
/* PDF İndirme Modalı */
#pdf-download-modal {
    display: none;
}
#pdf-download-modal.show {
    display: flex;
}
/* Toggle Switch Stilleri */
label:has(#duble:checked) > div,
label:has(.olcu-duble:checked) > div {
    background-color: #137fec !important;
}
label:has(#duble:checked) > div > span,
label:has(.olcu-duble:checked) > div > span {
    transform: translateX(1.25rem);
    background-color: #f8fafc;
    border-color: #cbd5e1;
}
.dark label:has(#duble:checked) > div > span,
.dark label:has(.olcu-duble:checked) > div > span {
    background-color: #1e293b;
    border-color: #475569;
}
label:has(#duble) > div > span {
    background-color: #f1f5f9;
    border-color: #94a3b8;
}
.dark label:has(#duble) > div > span {
    background-color: #e2e8f0;
    border-color: #64748b;
}

/* Select elementinin mobilde koyu tema desteği */
select {
    background-color: white;
    color: #1e293b;
}
.dark select {
    background-color: #1e293b;
    color: white;
}
/* Select dropdown'un mobilde koyu tema görünmesi */
@media (max-width: 768px) {
    select {
        background-color: #1e293b !important;
        color: white !important;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }
    select option {
        background-color: #1e293b !important;
        color: white !important;
    }
    select:active,
    select:focus,
    select:focus-visible,
    select:focus-within {
        background-color: #1e293b !important;
        color: white !important;
    }
    select:active option,
    select:focus option,
    select:focus-visible option,
    select:focus-within option {
        background-color: #1e293b !important;
        color: white !important;
    }
    /* iOS için özel stil */
    @supports (-webkit-touch-callout: none) {
        select {
            background-color: #1e293b !important;
            color: white !important;
        }
        select option {
            background-color: #1e293b !important;
            color: white !important;
        }
        select:active,
        select:focus {
            background-color: #1e293b !important;
            color: white !important;
        }
        select:active option,
        select:focus option {
            background-color: #1e293b !important;
            color: white !important;
        }
    }
    /* Android için özel stil */
    @supports not (-webkit-touch-callout: none) {
        select {
            background-color: #1e293b !important;
            color: white !important;
        }
        select option {
            background-color: #1e293b !important;
            color: white !important;
        }
    }
}
/* Date input koyu tema desteği */
input[type="date"] {
    color-scheme: light;
}
.dark input[type="date"] {
    color-scheme: dark;
    background-color: #1e293b !important;
    color: transparent !important;
}
.dark input[type="date"]:focus {
    background-color: #1e293b !important;
    color: white !important;
}
.dark input[type="date"]:valid {
    color: white !important;
}
/* Date picker calendar koyu tema */
.dark input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}
/* Mobil scroll bar gizleme */
@media (max-width: 768px) {
    .overflow-x-auto::-webkit-scrollbar {
        display: none;
    }
    .overflow-x-auto {
        -ms-overflow-style: none;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch; /* iOS smooth scroll */
    }
    
    /* Geçmiş sayfası tablosu mobilde scroll edilebilir */
    #history-page table {
        min-width: 800px; /* Tablonun minimum genişliği */
    }
    
    /* Mobilde butonlar daha büyük ve tıklanabilir */
    #history-page button {
        min-width: 44px;
        min-height: 44px;
        touch-action: manipulation;
    }
    
    /* Mobilde tablo hücreleri daha kompakt */
    #history-page .table-col-checkbox {
        width: 50px !important;
        min-width: 50px !important;
    }
    
    #history-page .table-col-projeno {
        min-width: 120px !important;
    }
    
    #history-page .table-col-tarih {
        min-width: 100px !important;
    }
    
    #history-page .table-col-imalat {
        min-width: 80px !important;
    }
    
    #history-page .table-col-aciklama {
        min-width: 200px !important;
    }
    
    #history-page .table-col-islemler {
        width: 120px !important;
        min-width: 120px !important;
    }
    input[type="date"] {
        color-scheme: dark;
        background-color: #1e293b !important;
        color: transparent !important;
    }
    input[type="date"]:focus {
        background-color: #1e293b !important;
        color: white !important;
    }
    input[type="date"]:valid {
        color: white !important;
    }
    input[type="date"]::-webkit-calendar-picker-indicator {
        filter: invert(1);
        cursor: pointer;
    }
}

/* OAuth Buton Stilleri */
.oauth-button {
    position: relative;
    overflow: hidden;
}

.oauth-button:active {
    transform: scale(0.98);
}

.oauth-button.google-button:hover {
    border-color: #4285F4;
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.2);
}

.oauth-button.apple-button:hover {
    opacity: 0.9;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.oauth-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Mobil Optimizasyonları */
@media (max-width: 640px) {
    .safe-area-inset {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    /* Touch-friendly input alanları */
    input[type="email"],
    input[type="password"],
    input[type="text"] {
        font-size: 16px; /* iOS zoom'u önlemek için */
    }
}

/* iOS özel optimizasyonları */
@supports (-webkit-touch-callout: none) {
    .oauth-button {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
    
    input[type="email"],
    input[type="password"],
    input[type="text"] {
        font-size: 16px; /* iOS zoom'u önlemek için */
    }
}

/* Viewport height değişikliklerini handle etme */
@supports (height: 100dvh) {
    .page {
        min-height: 100dvh;
    }
}

/* Keyboard açıldığında layout bozulmaması için */
@media (max-width: 768px) {
    #login-page {
        min-height: -webkit-fill-available;
    }
    
    /* Form input'ları mobilde daha büyük yap (min-height: 44px) */
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    input[type="date"],
    select,
    textarea {
        min-height: 44px !important;
        font-size: 16px !important; /* iOS zoom'u önlemek için */
    }
    
    /* Butonlar mobilde daha kolay tıklanabilir */
    button {
        min-height: 44px !important;
        min-width: 44px !important;
        touch-action: manipulation;
    }
    
    /* Tablolar mobilde scroll edilebilir */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
    
    /* Modal'lar mobilde tam ekran veya daha büyük */
    .modal-content,
    [class*="modal"] {
        width: 95% !important;
        max-width: 95% !important;
        margin: 10px auto !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }
    
    /* Header ve navigation mobilde optimize */
    header {
        padding: 12px 16px !important;
    }
    
    header button {
        padding: 8px 12px !important;
        font-size: 14px !important;
    }
    
    /* Geçmiş sayfası tablosu mobilde scroll edilebilir */
    #history-page .overflow-x-auto {
        -webkit-overflow-scrolling: touch; /* iOS smooth scroll */
    }
    
    #history-page table {
        min-width: 800px; /* Tablonun minimum genişliği */
    }
    
    /* Mobilde butonlar daha büyük ve tıklanabilir */
    #history-page button {
        min-width: 44px !important;
        min-height: 44px !important;
        touch-action: manipulation;
        padding: 10px !important;
    }
    
    /* Mobilde tablo hücreleri daha kompakt */
    #history-page .table-col-checkbox {
        width: 50px !important;
        min-width: 50px !important;
    }
    
    #history-page .table-col-projeno {
        min-width: 120px !important;
    }
    
    #history-page .table-col-tarih {
        min-width: 100px !important;
    }
    
    #history-page .table-col-imalat {
        min-width: 80px !important;
    }
    
    #history-page .table-col-aciklama {
        min-width: 200px !important;
    }
    
    #history-page .table-col-islemler {
        width: 120px !important;
        min-width: 120px !important;
        position: sticky;
        right: 0;
        background: inherit;
        z-index: 10;
    }
    
    /* Mobilde silme butonu daha görünür */
    #history-page .table-col-islemler button {
        min-width: 44px !important;
        min-height: 44px !important;
    }
    
    /* Mobilde imalat butonu daha büyük ve tıklanabilir */
    #history-page .toggle-imalat-btn {
        min-width: 48px !important;
        min-height: 48px !important;
        touch-action: manipulation;
        cursor: pointer;
    }
    
    /* Mobilde tablo satırları daha kompakt */
    #history-page tbody tr {
        height: auto !important;
    }
    
    #history-page tbody td {
        padding: 8px 4px !important;
        font-size: 13px !important;
    }
    
    /* Mobilde header başlıkları daha küçük ve entegre */
    header h1,
    header h2 {
        font-size: 14px !important;
        line-height: 1.3 !important;
        padding: 0 8px !important;
    }
    
    /* Ana sayfa header başlığı mobilde daha kompakt */
    #main-page header h1 {
        font-size: 13px !important;
        max-width: calc(100% - 120px) !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    /* Mobilde "Hesaplama Formu" başlığı tam görünsün */
    #main-page main h2 {
        font-size: 20px !important;
        line-height: 1.2 !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        max-width: 100% !important;
    }
}

/* PC ve mobil için imalat butonu stilleri */
#history-page .toggle-imalat-btn {
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#history-page .toggle-imalat-btn:active {
    transform: scale(0.95);
    transition: transform 0.1s;
}

