/**
 * gbHam - Stylesheet
 * Clean, accessible, minimal CSS
 */

/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    line-height: 1.5;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Typography === */
h1, h2, h3 {
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 1.75rem;
    color: #1a1a1a;
}

h2 {
    font-size: 1.25rem;
    color: #333;
    border-bottom: 2px solid #0066cc;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.1rem;
    color: #444;
    margin-top: 1.5rem;
}

p {
    margin-bottom: 0.75rem;
}

a {
    color: #0066cc;
    text-decoration: none;
}

a:hover, a:focus {
    text-decoration: underline;
}

/* === Layout === */
header {
    background: linear-gradient(135deg, #0066cc 0%, #004499 100%);
    color: white;
    padding: 1.5rem;
    text-align: center;
}

header h1 {
    color: white;
}

header .subtitle {
    opacity: 0.9;
    font-size: 0.95rem;
    margin-bottom: 0;
}

nav {
    background: #333;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.nav-links a {
    color: white;
    font-size: 0.95rem;
}

.nav-links a:hover {
    color: #66b3ff;
}

/* Language Switcher */
.lang-switcher {
    display: flex;
    gap: 0.25rem;
}

.lang-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #aaa;
    background: transparent;
    border: 1px solid #555;
    border-radius: 3px;
    text-decoration: none;
    transition: all 0.2s;
}

.lang-btn:hover {
    color: white;
    border-color: #888;
    text-decoration: none;
}

.lang-btn.active {
    color: white;
    background: #0066cc;
    border-color: #0066cc;
    font-weight: 700;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.4);
    pointer-events: none;
    text-decoration: underline;
    transform: scale(1.1);
}

main {
    flex: 1;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem;
}

footer {
    background: #333;
    color: #ccc;
    text-align: center;
    padding: 1rem;
    font-size: 0.85rem;
}

footer a {
    color: #99ccff;
}

footer .version {
    opacity: 0.7;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

section {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* === Form Styles === */
.entry-form {
    max-width: 500px;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: #444;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #0066cc;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #666;
    font-size: 0.85rem;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Honeypot field - hidden */
.hp-field {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    overflow: hidden;
}

.btn-submit {
    background: #0066cc;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-submit:hover,
.btn-submit:focus {
    background: #0052a3;
}

.privacy-hint {
    font-size: 0.85rem;
    color: #666;
    margin-top: 1rem;
}

/* === Messages === */
.message {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-weight: 500;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.info {
    background: #e7f3ff;
    color: #004085;
    border: 1px solid #b8daff;
}

/* === Entries List === */
.entries-list {
    list-style: none;
}

.entry {
    border-bottom: 1px solid #eee;
    padding: 1rem 0;
}

.entry:last-child {
    border-bottom: none;
}

.entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.entry .callsign {
    font-size: 1.05rem;
    color: #0066cc;
    font-family: monospace;
}

.entry time {
    font-size: 0.85rem;
    color: #888;
}

.entry-runde {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.entry-runde .runde-label {
    font-weight: 600;
    color: #555;
}

.entry-message {
    color: #444;
    margin-bottom: 0;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.no-entries {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

/* === Privacy Page === */
.privacy-content {
    line-height: 1.7;
}

.privacy-content ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.privacy-content li {
    margin-bottom: 0.35rem;
}

.privacy-content address {
    font-style: normal;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
}

.privacy-date {
    margin-top: 2rem;
    color: #666;
}

/* === Admin Page === */
.admin-page header {
    background: linear-gradient(135deg, #444 0%, #222 100%);
}

.control-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    justify-content: space-between;
}

.status-info p {
    margin-bottom: 0.25rem;
}

.status-readonly {
    color: #dc3545;
    font-weight: 600;
}

.status-active {
    color: #28a745;
    font-weight: 600;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: opacity 0.2s;
}

.btn:hover {
    opacity: 0.9;
    text-decoration: none;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}

.inline-form {
    display: inline;
}

/* === Admin Table === */
.entries-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.entries-table th,
.entries-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.entries-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #444;
}

.entries-table .callsign {
    font-family: monospace;
    font-weight: 600;
}

.entries-table .message-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* === Pagination === */
.entries-count {
    font-weight: 400;
    color: #666;
    font-size: 0.9em;
}

.pagination {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.pagination-info {
    color: #666;
    font-size: 0.9rem;
}

.pagination-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.875rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #0066cc;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s;
    min-width: 44px;
    min-height: 44px;
}

.pagination-btn:hover:not(.disabled) {
    background: #f0f7ff;
    border-color: #0066cc;
    text-decoration: none;
}

.pagination-btn.disabled {
    color: #aaa;
    background: #f5f5f5;
    border-color: #eee;
    cursor: not-allowed;
}

.pagination-first,
.pagination-last {
    padding: 0.5rem 0.625rem;
}

/* === Responsive === */
@media (max-width: 600px) {
    header {
        padding: 1rem;
    }

    h1 {
        font-size: 1.4rem;
    }

    nav {
        flex-direction: column;
        gap: 0.5rem;
    }

    .nav-links {
        gap: 1rem;
        justify-content: center;
    }

    .lang-switcher {
        order: -1;
    }

    main {
        padding: 1rem;
    }

    section {
        padding: 1rem;
    }

    .control-panel {
        flex-direction: column;
        align-items: flex-start;
    }

    .entries-table {
        font-size: 0.8rem;
    }

    .entries-table th,
    .entries-table td {
        padding: 0.5rem;
    }

    .entries-table .message-cell {
        max-width: 150px;
    }

    /* Pagination mobile */
    .pagination {
        gap: 0.5rem;
    }

    .pagination-controls {
        width: 100%;
        justify-content: space-between;
    }

    .pagination-btn {
        padding: 0.625rem 0.75rem;
        font-size: 0.85rem;
        flex: 1;
        max-width: none;
    }

    .pagination-first,
    .pagination-last {
        flex: 0 0 auto;
        padding: 0.625rem;
    }

    .pagination-prev,
    .pagination-next {
        flex: 1;
    }
}

/* === Accessibility === */
:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

:focus-visible {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .entry {
        border-bottom: 2px solid #333;
    }

    .form-group input,
    .form-group textarea {
        border: 2px solid #333;
    }
}
