html, body {
    min-height: 100%;
}

/* Flex icindeki main genelde min-width:auto ile tasir; sifirla */
main.flex-1 {
    min-width: 0;
}

img, video {
    max-width: 100%;
    height: auto;
}

.nav-scroll-mobile {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.nav-scroll-mobile::-webkit-scrollbar {
    display: none;
}

body {
    -webkit-tap-highlight-color: transparent;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: radial-gradient(circle at top, #1e293b 0%, #020617 60%);
    color: #e2e8f0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

main {
    -webkit-overflow-scrolling: touch;
}
.draggable-item { position: absolute; cursor: grab; user-select: none; z-index: 10; transition: transform .2s ease; touch-action: none; }
.draggable-item:active { cursor: grabbing; z-index: 100 !important; }
.hide { display: none !important; }
.tab-active { border-bottom: 2px solid #22d3ee; color: #67e8f9; font-weight: bold; background: rgba(30, 41, 59, .75); }
.tab-inactive { color: #94a3b8; font-weight: 500; }

.glass-panel {
    background: linear-gradient(135deg, rgba(15, 23, 42, .88), rgba(30, 41, 59, .82));
    border: 1px solid rgba(148, 163, 184, .2);
    backdrop-filter: blur(12px);
}

.card-dark {
    background: rgba(15, 23, 42, .8);
    border: 1px solid rgba(100, 116, 139, .28);
    box-shadow: 0 20px 30px -26px rgba(0, 0, 0, .95);
    overflow-wrap: anywhere;
    word-break: break-word;
}

#drawing-canvas {
    pointer-events: none;
}

#drawing-canvas.drawing-active {
    pointer-events: auto;
    cursor: crosshair;
}

#material-list {
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
}

#material-list .material-card-form {
    scroll-snap-align: start;
}

.note-sticker {
    position: absolute;
    min-width: 120px;
    max-width: min(240px, calc(100vw - 2rem));
    z-index: 12;
    background: rgba(250, 204, 21, 0.93);
    color: #1f2937;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 10px 18px -14px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(234, 179, 8, 0.9);
}

.note-sticker textarea {
    width: 100%;
    resize: vertical;
    min-height: 56px;
    background: transparent;
    outline: none;
    border: 0;
    font-size: 13px;
    line-height: 1.35;
}

.material-chip {
    border: 1px solid rgba(71, 85, 105, .9);
    background: rgba(15, 23, 42, .85);
    color: #cbd5e1;
    border-radius: 9999px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    transition: all .2s ease;
    flex-shrink: 0;
    touch-action: manipulation;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.material-chip:hover {
    border-color: #22d3ee;
    color: #a5f3fc;
}

.material-chip.active {
    background: rgba(8, 145, 178, .2);
    border-color: rgba(34, 211, 238, .8);
    color: #a5f3fc;
}

.modal {
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
    padding-top: max(0.75rem, env(safe-area-inset-top));
    align-items: center;
    justify-content: center;
}
.modal.active {
    opacity: 1;
    pointer-events: auto;
    display: flex !important;
}
.modal-content {
    transform: translateY(12px) scale(.98);
    opacity: .88;
    transition: transform .25s ease, opacity .25s ease;
}
.modal.active .modal-content {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.entering {
    animation: dropIn .35s ease-out;
}

.removing {
    animation: fadeOutDown .25s ease forwards;
}

@keyframes dropIn {
    0% { opacity: 0; transform: translateY(-24px) scale(.95); filter: blur(2px); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeOutDown {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(12px) scale(.95); }
}

@keyframes bounceSnap {
    0% { transform: scale(1); }
    45% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

@media (max-width: 768px) {
    .draggable-item {
        max-width: calc(100vw - 2rem);
    }
}

.touch-manipulation {
    touch-action: manipulation;
}

.table-responsive-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

@media (min-width: 640px) {
    .table-responsive-wrap {
        margin-left: 0;
        margin-right: 0;
        padding-left: 0;
        padding-right: 0;
    }
}

/* iOS: 16px+ inputs reduce unwanted zoom on focus */
@media (max-width: 640px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="url"],
    input[type="number"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px;
    }
}
