/* Apple-inspired Design */
* {
    box-sizing: border-box;
}

body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    margin: 0;
    padding: 20px;
    line-height: 1.6;
    color: #1d1d1f;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

/* Wider container in edit mode */
.container.edit-mode {
    max-width: 1400px;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.status-bar {
    padding: 20px 30px;
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-edit { background: #34c759; }
.status-read { background: #ff9500; }

.btn {
    background: rgba(0, 122, 255, 0.1);
    color: #007aff;
    border: 1px solid rgba(0, 122, 255, 0.3);
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn:hover {
    background: rgba(0, 122, 255, 0.2);
    transform: translateY(-1px);
}

.table-container {
    padding: 0 30px 30px;
    overflow-x: auto;
}

#shootingTable {
    width: 100% !important;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

#shootingTable thead th {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #495057;
    font-weight: 600;
    padding: 16px 12px;
    text-align: left;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    border-bottom: 2px solid #dee2e6;
}

#shootingTable tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid #f8f9fa;
}

#shootingTable tbody tr:hover {
    background: rgba(0, 122, 255, 0.02);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

#shootingTable tbody td {
    padding: 16px 12px;
    vertical-align: top;
    border: none;
    position: relative;
}

/* DataTables responsive controls */
.dtr-control {
    position: relative;
    cursor: pointer;
}

.dtr-control:before {
    content: '';
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background: #28a745;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.dtr-control.parent:before {
    background: #dc3545;
}

/* Add padding to cells with responsive controls */
.dtr-control {
    padding-left: 30px !important;
}

td[contenteditable="true"] { 
    background: rgba(255, 204, 0, 0.1);
    border-radius: 6px;
    transition: all 0.2s ease;
}

td[contenteditable="true"]:focus {
    background: white;
    outline: 2px solid #007aff;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

.multiline-cell {
    white-space: pre-wrap;
    word-wrap: break-word;
    min-height: 40px;
    max-width: 250px;
    line-height: 1.5;
}

/* Links Styling */
a {
    color: #007aff;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

a:hover {
    color: #0056cc;
    text-decoration: underline;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .header {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .status-bar {
        padding: 15px 20px;
        flex-direction: column;
        gap: 10px;
    }
    
    .table-container {
        padding: 0 20px 20px;
    }
    
    #shootingTable thead th,
    #shootingTable tbody td {
        padding: 12px 8px;
        font-size: 0.9rem;
    }
    
    .multiline-cell {
        max-width: 200px;
        min-height: 35px;
    }
    
    /* Better spacing for responsive controls on mobile */
    .dtr-control {
        padding-left: 35px !important;
    }
    
    .dtr-control:before {
        width: 14px;
        height: 14px;
        left: 6px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }
    
    #shootingTable thead th,
    #shootingTable tbody td {
        padding: 10px 6px;
        font-size: 0.8rem;
    }
    
    .multiline-cell {
        max-width: 150px;
    }
}

/* DataTables customization */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    margin: 10px 0;
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 12px;
    margin-left: 8px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 6px;
    margin: 0 2px;
    padding: 6px 12px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #007aff !important;
    border-color: #007aff !important;
    color: white !important;
}

.modal { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; background:rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 999; }
.modal-content { background: white; padding: 32px 24px; border-radius: 14px; min-width: 320px; box-shadow: 0 2px 14px rgba(0,0,0,0.2);}
.close { position: absolute; right: 28px; top: 20px; font-size: 1.7em; cursor: pointer; color: #888;}
#entryForm label { display: block; margin-bottom: 10px;}
#entryForm input, #entryForm textarea { width: 100%; margin-top: 3px; border-radius: 6px; border: 1px solid #bbb; padding: 5px 8px; }


/* MODAL Overlay (immer ganz oben!) */
.modal {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100vh;
	background: rgba(0,0,0,0.32);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10000;   /* HOCH! */
	transition: background 0.25s;
}

/* MODAL Card */
.modal-card {
	background: #fff;
	border-radius: 18px;
	padding: 2.2rem 2.2rem 1.7rem 2.2rem;
	box-shadow: 0 8px 32px rgba(50,50,70,0.16), 0 1.5px 10px rgba(30,60,120,0.07);
	min-width: 330px;
	max-width: 440px;
	width: 98vw;
	max-height: 96vh;
	overflow-y: auto;
	position: relative;
	animation: modal-pop 0.23s cubic-bezier(.42,1.21,.56,1) backwards;
	display: flex;
	flex-direction: column;
}

@keyframes modal-pop {
	from { transform: scale(0.93) translateY(44px); opacity: 0; }
}

/* MODAL Title & Close Button */
.modal-title {
	text-align: left;
	font-size: 1.35rem;
	font-weight: 600;
	color: #222;
	margin-bottom: 1.2rem;
	letter-spacing: -0.01em;
}
.modal-close {
	position: absolute;
	right: 20px; top: 20px;
	background: transparent;
	border: none;
	font-size: 2.1rem;
	color: #aaa;
	cursor: pointer;
	transition: color .2s;
	z-index: 10001;
}
.modal-close:hover { color: #444; }

/* ZWEISPALTIGES FORMULAR GRID */
.modal-form-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1.12rem 1.35rem;
}

.modal-form-row {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
}

/* Damit Textarea auf volle Breite geht */
.modal-form-row textarea {
	resize: vertical;
	min-height: 38px;
	max-height: 130px;
}

/* Das große Kommentarfeld (z.B. "Comment") über beide Spalten */
.modal-form-row:nth-child(5) {
	grid-column: 1 / span 2;
}

.modal-form-row label {
	font-size: 1.01rem;
	font-weight: 500;
	color: #53545a;
	margin-bottom: 2.5px;
	padding-left: 1px;
}

.modal-form-row input,
.modal-form-row textarea {
	padding: 10px 12px;
	border-radius: 10px;
	border: 1px solid #e0e2ea;
	background: #f8fafc;
	font-size: 1.05rem;
	transition: border .16s, background .17s;
}
.modal-form-row input:focus,
.modal-form-row textarea:focus {
	border-color: #6776fa;
	background: #fff;
	outline: none;
}

/* Aktionsleiste */
.modal-actions {
	text-align: right;
	margin-top: 1.35rem;
}
.modal-save-btn {
	background: #667eea;
	color: #fff;
	border: none;
	font-size: 1.08rem;
	font-weight: 600;
	padding: 11px 28px;
	border-radius: 11px;
	cursor: pointer;
	box-shadow: 0 1.5px 6px rgba(90,90,130,0.07);
	transition: background 0.18s, transform 0.13s;
}
.modal-save-btn:hover, .modal-save-btn:focus {
	background: #5560c7;
	transform: translateY(-1px) scale(1.015);
}

/* Mobil = einspaltig */
@media (max-width: 700px) {
	.modal-card { min-width: 0; max-width: 99vw; }
	.modal-form-grid { grid-template-columns: 1fr; }
	.modal-form-row:nth-child(5) { grid-column: 1 / span 1; }
	padding: 1.2rem 0.3rem 1.2rem 0.3rem;
}

/* Sicherstellen, dass das Modal IMMER ganz oben liegt */
body > .modal,
body .modal {
	z-index: 10000 !important;
}
