/* === RESET & BASE === */
*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    /* Family paleta 123Soft: navy #16233F + teal #0E98A8 */
    --color-primary: #0E98A8;       /* teal – akce, odkazy, aktivní prvky */
    --color-primary-dark: #0C7F8C;  /* tmavší teal – hover */
    --color-navy: #16233F;          /* navy – nadpisy, navbar accent */
    --color-success: #16a34a;
    --color-warning: #ca8a04;
    --color-danger: #dc2626;
    --color-info: #0E98A8;

    --color-bg: #f6f8fa;
    --color-surface: #ffffff;
    --color-text: #16233F;
    --color-text-muted: #64748b;
    --color-border: #e2e8f0;

    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === NAVBAR === */
.navbar {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    border-top: 3px solid var(--color-navy);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    height: 60px;
}

.nav-brand a {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--color-text);
    text-decoration: none;
    line-height: 0;
    display: block;
}

.nav-brand img {
    height: 32px;
    width: auto;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.nav-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background: var(--color-text);
    border-radius: 2px;
    transition: all 0.3s;
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

.nav-menu {
    display: flex;
    align-items: center;
    flex: 1;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    margin-left: 2rem;
    flex: 1;
}

.nav-link {
    color: var(--color-text-muted);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: all 0.15s;
}

.nav-link:hover {
    color: var(--color-text);
    background: var(--color-bg);
}

.nav-admin {
    color: var(--color-primary);
    font-weight: 500;
}

.nav-separator {
    color: var(--color-border);
    padding: 0 0.25rem;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

/* === CONTAINER === */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
    width: 100%;
}

.container-narrow {
    max-width: 500px;
}

/* === CARDS === */
.card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.card-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

/* === ALERTS === */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-info {
    background: #e0f2fe;
    color: #075985;
    border: 1px solid #bae6fd;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* === FORMS === */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

.form-hint {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-checkbox input {
    width: 1rem;
    height: 1rem;
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
}

.btn-secondary {
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-border);
}

.btn-success {
    background: var(--color-success);
    color: white;
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
}

/* === TABLES === */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.table th {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    background: var(--color-bg);
}

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

/* === BADGES / STATUS === */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-new { background: #dbeafe; color: #1e40af; }
.badge-in_progress { background: #fef3c7; color: #92400e; }
.badge-waiting { background: #e0e7ff; color: #3730a3; }
.badge-resolved { background: #dcfce7; color: #166534; }
.badge-closed { background: #f1f5f9; color: #475569; }

/* === STATS === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* === TICKET LIST === */
.ticket-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ticket-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--color-border);
    transition: background 0.15s;
}

.ticket-item:hover {
    background: var(--color-bg);
}

.ticket-item:last-child {
    border-bottom: none;
}

.ticket-number {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    min-width: 80px;
}

.ticket-content {
    flex: 1;
    min-width: 0;
}

.ticket-subject {
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
}

.ticket-subject:hover {
    color: var(--color-primary);
}

.ticket-meta {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

/* === COMMENTS === */
.comments {
    margin-top: 2rem;
}

.comment {
    padding: 1rem;
    border-left: 3px solid var(--color-border);
    margin-bottom: 1rem;
    background: var(--color-bg);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.comment-internal {
    border-left-color: var(--color-warning);
    background: #fffbeb;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.comment-author {
    font-weight: 500;
}

.comment-date {
    color: var(--color-text-muted);
}

.comment-content {
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* === PAGE HEADER === */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    margin: 0;
    font-size: 1.5rem;
    word-break: break-word;
}

/* === FILTERS === */
.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    border-radius: var(--radius);
    color: var(--color-text-muted);
    text-decoration: none;
    transition: all 0.15s;
}

.filter-btn:hover,
.filter-btn.active {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: #eff6ff;
}

/* === FOOTER === */

.footer {
    border-top: 1px solid var(--color-border);
    margin-top: auto;
}

.footer p {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

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

/* === LOGIN PAGE === */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo h1 {
    font-size: 1.5rem;
    margin: 0;
}

.login-logo p {
    color: var(--color-text-muted);
    margin: 0.5rem 0 0;
}

/* === PLACEHOLDER === */
.placeholder-page {
    text-align: center;
    padding: 4rem 2rem;
}

.placeholder-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.placeholder-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.placeholder-desc {
    color: var(--color-text-muted);
    max-width: 400px;
    margin: 0 auto;
}

/* === DETAIL === */
.detail-grid {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 0.75rem 1rem;
    margin-bottom: 1.5rem;
}

.detail-label {
    font-weight: 500;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.detail-value {
    color: var(--color-text);
    word-break: break-word;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .navbar-inner {
        flex-wrap: wrap;
        padding: 1rem;
        height: auto;
        align-items: center;
    }
    .nav-brand img {
        height: 24px;
    }
    .navbar {
        flex-wrap: wrap;
        height: auto;
        min-height: 60px;
        padding: 1rem;
    }

    .nav-brand {
        flex: 0 0 auto;
        order: 1;
    }

    .nav-toggle {
        display: flex;
        margin-left: auto;
        order: 2;
    }

    .nav-menu {
        display: none;
        flex-basis: 100%;
        order: 3;
        flex-direction: column;
        background: var(--color-surface);
        border-top: 1px solid var(--color-border);
        margin-top: 1rem;
        padding-top: 0.5rem;
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-links {
        flex-direction: column;
        margin: 0;
        gap: 0;
        width: 100%;
    }

    .nav-links .nav-link {
        display: block;
        width: 100%;
        padding: 1rem;
        border-bottom: 1px solid var(--color-border);
        text-align: center;
        font-size: 1.1rem;
    }

    .nav-links .nav-link:hover {
        background: var(--color-bg);
    }

    .nav-user {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 1rem;
        background: var(--color-bg);
        margin-top: 0.5rem;
        border-radius: var(--radius);
    }

    .container {
        padding: 1rem;
    }

    .card {
        padding: 1rem;
    }
    
    .card-wide {
    max-width: none;
    }

    .card-narrow {
    max-width: 600px;
    }

    .detail-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .table {
        font-size: 0.8rem;
    }

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

    .ticket-item {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn {
        padding: 0.6rem 1rem;
    }

    [style*="grid-template-columns: 2fr 1fr"] {
        display: block !important;
    }

    [style*="grid-template-columns: 2fr 1fr"] > div {
        margin-bottom: 1rem;
    }
    .card a {
        word-break: break-all;
    }

    .card ul a {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}
