/**
 * global.css - Globale Styles für ESP V2
 */

:root {
    --primary: #ff6a2b;
    --primary-dark: #e55318;
    --primary-light: #fff1ea;
    --secondary: #42b883;
    --danger: #d32f2f;
    --warning: #ff9800;
    --info: #ff8a33;
    --success: #4CAF50;
    --text-primary: #1f2328;
    --text-secondary: #495362;
    --text-light: #788290;
    --border: #d5dbe3;
    --border-light: #e8edf3;
    --bg-light: #eef1f5;
    --bg-white: #ffffff;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-large: 0 4px 16px rgba(0, 0, 0, 0.15);
    --radius: 4px;
    --transition: all 0.2s ease;
}

html[data-theme="dark"] {
    --primary: #ff8a4a;
    --primary-dark: #ff6a2b;
    --primary-light: #3a2a20;
    --secondary: #4ec68f;
    --danger: #ff6b6b;
    --warning: #ffb74d;
    --info: #ff9a5c;
    --success: #66bb6a;
    --text-primary: #eef2f7;
    --text-secondary: #c3ceda;
    --text-light: #93a0ae;
    --border: #334153;
    --border-light: #2a3544;
    --bg-light: #0f1722;
    --bg-white: #161f2c;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-large: 0 4px 16px rgba(0, 0, 0, 0.45);
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-light);
}

html[data-theme="dark"] body {
    color: var(--text-primary);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5em;
}

h1 { font-size: 28px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
h4 { font-size: 18px; }
h5 { font-size: 16px; }
h6 { font-size: 14px; }

p {
    margin-bottom: 1em;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Forms */
input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-white);
    color: inherit;
    transition: var(--transition);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 106, 43, 0.16);
}

input[type="checkbox"], input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

textarea {
    resize: vertical;
    font-family: 'Courier New', monospace;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Buttons */
button, .button, input[type="button"], input[type="submit"] {
    display: inline-block;
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    text-align: center;
    vertical-align: middle;
    user-select: none;
}

button:hover, .button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-large);
}

button:active, .button:active {
    transform: translateY(0);
}

button:disabled, .button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Button Variants */
.button-secondary {
    background: var(--text-secondary);
}

.button-secondary:hover {
    background: var(--text-primary);
}

.button-success {
    background: var(--success);
}

.button-success:hover {
    background: #388e3c;
}

.button-danger {
    background: var(--danger);
}

.button-danger:hover {
    background: #b71c1c;
}

.button-warning {
    background: var(--warning);
}

.button-warning:hover {
    background: #e65100;
}

.button-small {
    padding: 5px 10px;
    font-size: 12px;
}

.button-large {
    padding: 12px 30px;
    font-size: 16px;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-white);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    overflow: hidden;
}

thead {
    background: var(--bg-light);
}

th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border);
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-light);
}

tbody tr:hover {
    background-color: var(--bg-light);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Cards */
.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-large);
    transform: translateY(-2px);
}

/* Messages */
.message {
    padding: 12px 15px;
    border-radius: var(--radius);
    margin-bottom: 15px;
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: 10px;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border-left-color: #28a745;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border-left-color: #dc3545;
}

.message.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left-color: #17a2b8;
}

.message.warning {
    background-color: #fff3cd;
    color: #856404;
    border-left-color: #ffc107;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge.secondary {
    background: var(--text-secondary);
}

.badge.success {
    background: var(--success);
}

.badge.danger {
    background: var(--danger);
}

.badge.warning {
    background: var(--warning);
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.grid {
    display: grid;
    gap: 20px;
}

.flex {
    display: flex;
    gap: 10px;
}

.flex-center {
    justify-content: center;
    align-items: center;
}

.flex-between {
    justify-content: space-between;
    align-items: center;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }

.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.p-1 { padding: 10px; }
.p-2 { padding: 20px; }
.p-3 { padding: 30px; }

/* Responsive */
@media (max-width: 768px) {
    h1 { font-size: 24px; }
    h2 { font-size: 20px; }
    h3 { font-size: 18px; }

    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 8px 10px;
    }

    .button {
        width: 100%;
        display: block;
    }

    .hide-mobile {
        display: none !important;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }

    .no-print {
        display: none;
    }

    button, .button, a {
        border: 1px solid black;
    }
}

/* ── Fixed Side Buttons (Rand-Buttons links/rechts) ─────────────────────── */
.fixed-side-buttons {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.fixed-side-left  { left: 0; }
.fixed-side-right { right: 0; }

.fixed-side-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--primary, #e31b1b);
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--primary, #e31b1b) 88%, #101622 12%) 0%,
        color-mix(in srgb, var(--primary-dark, #c41010) 86%, #101622 14%) 100%
    );
    color: #fff;
    border: 1px solid color-mix(in srgb, var(--primary-light, #ffe6e6) 50%, #ffffff 30%);
    border-radius: 0 10px 10px 0;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    text-align: center;
    overflow: hidden;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
    transform: translateX(0);
}

.fixed-side-right .fixed-side-btn {
    border-radius: 10px 0 0 10px;
}

.fixed-side-btn img {
    width: 34px;
    height: 34px;
    object-fit: contain;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

.fixed-side-icon-text {
    font-size: 1.4rem;
    line-height: 1;
}

.fixed-side-btn:hover {
    background: var(--primary-dark, #c41010);
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--primary-dark, #c41010) 85%, #101622 15%) 0%,
        color-mix(in srgb, var(--primary, #e31b1b) 80%, #101622 20%) 100%
    );
    border-color: color-mix(in srgb, var(--primary-light, #ffe6e6) 62%, #ffffff 38%);
}

html[data-theme="dark"] .fixed-side-btn {
    border-color: color-mix(in srgb, var(--primary-light, #3a1c1c) 40%, #ffffff 40%);
    box-shadow: 0 8px 22px rgba(0,0,0,0.5);
}

.fixed-side-left .fixed-side-btn:hover {
    transform: translateX(8px);
}

.fixed-side-right .fixed-side-btn:hover {
    transform: translateX(-8px);
}

/* Mobile: unten links/rechts, horizontal */
@media (max-width: 768px) {
    .fixed-side-buttons {
        top: auto;
        bottom: 12px;
        transform: none;
        flex-direction: row;
    }
    .fixed-side-left  { left: 8px; }
    .fixed-side-right { right: 8px; }
    .fixed-side-btn {
        border-radius: 50%;
        width: 50px;
        height: 50px;
    }
    .fixed-side-right .fixed-side-btn { border-radius: 50%; }
    .fixed-side-btn img {
        width: 30px;
        height: 30px;
    }
    .fixed-side-left .fixed-side-btn:hover {
        transform: translateX(6px);
    }
    .fixed-side-right .fixed-side-btn:hover {
        transform: translateX(-6px);
    }
}