:root {
    --bg: #f5f5f7;
    --surface: #ffffff;
    --surface-soft: #f8f8fa;

    --text: #222222;
    --text-muted: #6b6b73;

    --border: #e4e4e8;

    --primary: #222222;
    --primary-text: #ffffff;

    --success: #197a45;

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;

    --container: 1600px;
}

* {
    box-sizing: border-box;
}

/*
 * Ό,τι έχει το attribute hidden δεν φαίνεται ποτέ, ακόμα κι αν
 * το CSS του ορίζει display (π.χ. flex). Τα φίλτρα και οι αναζητήσεις
 * κρύβουν στοιχεία έτσι.
 */
[hidden] {
    display: none !important;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

/* Εικονίδια από assets/img/icons (icon()) */
svg.icon {
    width: 1em;
    height: 1em;

    flex: none;

    vertical-align: -0.14em;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

img {
    display: block;
    max-width: 100%;
}

.container {
    width: min(
        var(--container),
        calc(100% - 40px)
    );

    margin: 0 auto;
}

.page {
    padding: 10px 0;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;

    margin-bottom: 10px;
}

.page-header h1 {
    margin: 0 0 0px;
    font-size: 32px;
    line-height: 1.15;
}

.page-header p {
    margin: 0;
    color: var(--text-muted);
}

.toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
}

.search-input {
    width: 100%;
    height: 52px;

    padding: 0 18px;

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    background: var(--surface);
    color: var(--text);

    outline: none;
}

.search-input:focus {
    border-color: #aaa;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-height: 44px;
    padding: 0 16px;

    border: 0;
    border-radius: 12px;

    cursor: pointer;

    font-weight: 600;
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-text);
}

.btn-secondary {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}

.btn-success {
    background: #e9f7ef;
    color: var(--success);
}

.btn-danger-outline {
    border: 1px solid #f3c7c7;

    background: var(--surface);
    color: #a92b2b;
}

.btn-danger-outline:hover {
    background: #feecec;
}

.btn-success-outline {
    border: 1px solid #b9e3c9;

    background: var(--surface);
    color: var(--success);
}

.btn-success-outline:hover {
    background: #e9f7ef;
}

.btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.empty-state {
    padding: 50px 30px;

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    background: var(--surface);

    text-align: center;
    color: var(--text-muted);
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;

    border-bottom: 1px solid var(--border);

    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
}

.app-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 50px;
}

.app-brand {
    font-size: 18px;
    font-weight: 700;
}

.app-nav {
    display: flex;
    align-items: center;
    gap: 6px;

    margin-left: auto;
}

.app-user {
    display: flex;
    align-items: center;
    gap: 8px;

    margin: 0 0 0 16px;
    padding-left: 16px;

    border-left: 1px solid var(--border);
}

.app-user-name {
    color: var(--text-muted);

    font-size: 14px;
    font-weight: 600;
}

.app-logout {
    padding: 8px 12px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: var(--surface);
    color: var(--text);

    cursor: pointer;

    font-size: 13px;
    font-weight: 600;
}

.app-logout:hover {
    background: var(--surface-soft);
}

.app-nav a {
    padding: 10px 14px;

    border-radius: 10px;

    color: var(--text-muted);

    font-size: 14px;
    font-weight: 600;
}

.app-nav a:hover {
    background: var(--surface-soft);
    color: var(--text);
}

.app-nav a.active {
    background: var(--primary);
    color: var(--primary-text);
}

@media (max-width: 650px) {

    .app-header-inner {
        min-height: auto;
        padding: 12px 0;

        align-items: flex-start;
        flex-direction: column;

        gap: 10px;
    }

    .app-nav {
        width: 100%;
        margin-left: 0;
    }

    .app-user {
        margin: 0;
        padding-left: 0;

        border-left: 0;
    }

    .app-nav a {
        flex: 1;
        padding: 10px 6px;

        text-align: center;
        white-space: nowrap;
    }
}

@media (max-width: 700px) {
    .container {
        width: min(
            100% - 24px,
            var(--container)
        );
    }

    .page {
        padding: 24px 0;
    }

    .page-header {
        flex-direction: column;
    }

    .page-header h1 {
        font-size: 27px;
    }
}

/* Flash messages */

.alert {
    margin-bottom: 22px;
    padding: 14px 17px;

    border-radius: 12px;
}

.alert.success {
    background: #eaf8ef;
    color: #146d3f;
}

.alert.error {
    background: #feecec;
    color: #a92b2b;
}

.app-migrations-alert {
    display: block;

    margin-top: 16px;
}

.migration-sql {
    margin: 10px 0;
    padding: 10px;

    border-radius: 8px;

    background: rgba(0, 0, 0, 0.05);

    font-size: 12px;
    white-space: pre-wrap;
}


/* Κουμπί «πίσω» στην κορυφή των σελίδων (back_link() στο helpers.php) */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    min-height: 38px;
    margin: 4px 0 14px;
    padding: 0 16px 0 10px;

    border: 1px solid var(--border);
    border-radius: 999px;

    background: var(--surface);
    color: var(--text-muted);

    font-size: 14px;
    font-weight: 700;

    transition:
        color 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.back-link svg {
    width: 18px;
    height: 18px;

    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;

    transition: transform 0.15s ease;
}

.back-link:hover {
    border-color: #c9c9d0;
    color: var(--text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.back-link:hover svg {
    transform: translateX(-2px);
}

.back-link:focus-visible {
    outline: 3px solid #999;
    outline-offset: 2px;
}
