/* Demirbaş Takip - Mobil Öncelikli CSS */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --text: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    padding-bottom: 80px;
}

/* Header */
.header {
    background: var(--bg-card);
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    font-weight: 700;
}

.logo i {
    color: var(--primary-light);
}

.header-actions {
    display: flex;
    gap: 8px;
}

.header-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-btn:active {
    transform: scale(0.95);
    background: var(--primary);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 60px;
    right: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    z-index: 200;
    min-width: 160px;
}

.dropdown-menu.open {
    display: block;
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
}

.dropdown-menu a:last-child {
    border-bottom: none;
}

/* Search */
.search-section {
    padding: 12px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.search-form {
    display: flex;
    gap: 8px;
}

.search-input-wrap {
    flex: 1;
    position: relative;
}

.search-input-wrap i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input-wrap input {
    width: 100%;
    padding: 12px 40px 12px 40px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
}

.search-input-wrap input:focus {
    outline: none;
    border-color: var(--primary);
}

.clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 5px;
    cursor: pointer;
}

.filter-toggle {
    width: 46px;
    height: 46px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
}

.filter-panel {
    display: none;
    padding-top: 12px;
}

.filter-panel.open {
    display: block;
}

.filter-panel form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-panel select {
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
}

.btn-filter {
    padding: 12px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 600;
    cursor: pointer;
}

/* Stats */
.stats-bar {
    display: flex;
    padding: 12px 16px;
    gap: 12px;
    background: var(--bg-dark);
}

.stat {
    flex: 1;
    background: var(--bg-card);
    padding: 12px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.stat-num {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-light);
}

.stat-txt {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Item List */
.main-list {
    padding: 8px 16px;
}

.item-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.item-card:active {
    transform: scale(0.98);
    background: var(--bg-input);
}

.item-photo {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.item-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-photo i {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.photo-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: var(--primary);
    color: white;
    font-size: 0.65rem;
    padding: 2px 5px;
    border-radius: 8px;
}

.item-info {
    flex: 1;
    min-width: 0;
}

.item-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-meta {
    display: flex;
    gap: 6px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.meta-tag {
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 500;
}

.item-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.item-details span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.item-arrow {
    color: var(--text-muted);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.3;
    display: block;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 16px;
}

.page-btn {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none;
}

.page-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* FAB */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.5);
    z-index: 90;
}

.fab:active {
    transform: scale(0.95);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
}

.modal.open {
    display: flex;
}

.modal-full {
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-header h2 {
    flex: 1;
    font-size: 1.1rem;
    font-weight: 600;
}

.back-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
}

/* Form Tabs */
.form-tabs {
    display: flex;
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 16px;
    padding: 4px;
}

.tab-btn {
    flex: 1;
    padding: 10px 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.tab-btn i {
    font-size: 1rem;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Form */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.input-action {
    display: flex;
    gap: 8px;
}

.input-action input {
    flex: 1;
}

.action-btn {
    width: 48px;
    background: var(--info);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
}

/* Photos */
.photo-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.photo-action-btn {
    flex: 1;
    padding: 16px;
    background: var(--bg-card);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.photo-preview-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.photo-preview-item {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
}

.photo-preview-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    cursor: pointer;
}

.photo-delete-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    background: var(--danger);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 0.8rem;
    cursor: pointer;
}

/* Scanner */
.scanner-full,
.camera-full {
    background: #000;
}

.scanner-header,
.camera-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10;
}

.scanner-header h2,
.camera-header h2,
.scanner-header .back-btn,
.camera-header .back-btn {
    color: white;
}

#scanner-container {
    width: 100%;
    height: 100%;
}

.scanner-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.scan-region {
    width: 250px;
    height: 250px;
    border: 3px solid var(--primary-light);
    border-radius: 20px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        border-color: var(--primary-light);
    }

    50% {
        border-color: var(--success);
    }
}

.scanner-hint {
    position: absolute;
    bottom: 100px;
    left: 0;
    right: 0;
    text-align: center;
    color: white;
    font-size: 0.9rem;
}

#cameraVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.shutter-btn {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: white;
    border: 4px solid var(--text-muted);
    cursor: pointer;
}

/* Image Viewer */
.image-viewer {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.image-viewer.open {
    display: flex;
}

.image-viewer img {
    max-width: 95%;
    max-height: 80%;
    object-fit: contain;
}

.close-viewer {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    background: var(--danger);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
}

/* Detail View */
.detail-item {
    background: var(--bg-card);
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.detail-item .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.detail-item .value {
    font-size: 0.9rem;
    font-weight: 500;
    word-break: break-all;
}

.detail-photos {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.detail-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
    aspect-ratio: 1;
}

/* Select2 Custom */
.select2-container--default .select2-selection--single {
    background: var(--bg-input) !important;
    border: 1px solid var(--border) !important;
    height: 48px !important;
    padding: 8px !important;
    border-radius: var(--radius-sm) !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text) !important;
    line-height: 28px !important;
}

.select2-dropdown {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
}

.select2-search__field {
    background: var(--bg-input) !important;
    color: var(--text) !important;
}

.select2-results__option {
    color: var(--text) !important;
}

.select2-results__option--highlighted {
    background: var(--primary) !important;
}

/* Toast */
#toast {
    position: fixed;
    bottom: 90px;
    left: 16px;
    right: 16px;
    padding: 14px 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 3000;
}

#toast.show {
    transform: translateY(0);
    opacity: 1;
}

@media (min-width: 768px) {

    .header,
    .search-section,
    .stats-bar {
        padding: 16px 24px;
    }

    .main-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: 16px;
        padding: 16px 24px;
    }

    .modal-full {
        max-width: 600px;
        max-height: 90vh;
        margin: auto;
        border-radius: var(--radius);
    }

    .photo-preview-list,
    .detail-photos {
        grid-template-columns: repeat(4, 1fr);
    }
}