html {
    font-size: 80%;
}

body {
    background-image: url("../../image/pozadina.jpg");
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    font-family: "Poppins", sans-serif;
    font-size: 13.44px;
    background-color: #f4f4f4;
    min-height: 100vh;
    margin: 0;
    color: #163329;
    overflow-x: hidden;
}

.page-shell {
    width: min(823px, calc(100% - 24px));
    margin: 12px auto;
}

.dashboard-shell {
    width: min(991px, calc(100% - 28px));
    margin: 14px auto;
}

.auth-wrap {
    display: flex;
    justify-content: center;
    padding: 10px 0;
}

.auth-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.auth-brand img {
    width: min(128px, 100%);
    height: auto;
}

.login-container,
.register-container,
.page-panel {
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(10px);
    padding: 18px 22px;
    border-radius: 15px;
    box-shadow: 0 18px 40px rgba(23, 47, 38, 0.14);
    text-align: center;
}

.login-container,
.register-container {
    width: min(309px, 100%);
}

.auth-compact {
    width: min(376px, 100%);
    max-width: 376px;
    padding: 18px 20px;
    margin-top: 14px;
}

.auth-compact h2 {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 5px;
}

.auth-compact p {
    font-size: 9.5px;
    margin-bottom: 12px;
}

.auth-compact .form-stack {
    gap: 6px;
}

.auth-compact .form-stack input {
    padding: 7px 8px;
    font-size: 9.5px;
}

.auth-compact .btn,
.auth-compact .btn-link {
    min-width: 87px;
    min-height: 28px;
    padding: 6px 11px;
    font-size: 9.5px;
    border-radius: 7px;
}

.auth-compact .auth-link {
    margin-top: 10px;
    font-size: 9.5px;
}

.page-panel {
    width: 100%;
    text-align: left;
}

.dashboard-panel {
    max-width: none;
    margin: 0 auto;
    padding: 14px 18px 12px;
}

.page-panel.panel-narrow {
    max-width: 605px;
    margin: 0 auto;
}

.generator-panel {
    max-width: 510px !important;
    padding: 14px 16px;
}

.generator-panel .page-title {
    font-size: clamp(15px, 2.02vw, 20px);
    margin-bottom: 5px;
}

.generator-panel .page-subtitle {
    font-size: 9.5px;
    margin-bottom: 12px;
}

.generator-panel .form-stack {
    gap: 8px;
}

.generator-panel .form-stack input,
.generator-panel .form-stack select {
    padding: 7px 9px;
    font-size: 9.5px;
    border-radius: 7px;
}

.generator-panel .btn,
.generator-panel .btn-link {
    min-width: 95px;
    min-height: 28px;
    padding: 6px 11px;
    font-size: 9.5px;
    border-radius: 8px;
}

.page-title,
.login-container h2,
.register-container h2 {
    color: #1c6b4a;
    margin: 0 0 6px;
    font-size: clamp(22px, 2.69vw, 28px);
    line-height: 1.1;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.page-title-shared {
    font-size: clamp(18px, 2.27vw, 23px);
    font-weight: 500;
}

.page-subtitle,
.login-container p,
.register-container p {
    color: #2a3d35;
    margin: 0 0 12px;
    font-size: 10.5px;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field-help {
    margin: -4px 0 2px;
    font-size: 9px;
    color: #546a61;
}

.form-stack input,
.form-stack select,
.form-stack textarea,
.filter-bar select {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 11px;
    border: 1px solid #c9d8d0;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.96);
    font: inherit;
    color: #183128;
}

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

.password-field {
    position: relative;
    width: 100%;
    display: block;
}

.password-field input {
    width: 100%;
    display: block;
    padding-right: 40px !important;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #5b6d66;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    font-size: 0;
    line-height: 1;
    z-index: 2;
    appearance: none;
    -webkit-appearance: none;
}

.password-toggle:hover {
    color: #1c6b4a;
}

.password-toggle.is-active {
    color: #4a90e2;
}

.password-toggle svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

.action-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.action-row.center {
    justify-content: center;
}

.btn,
.btn-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 114px;
    min-height: 36px;
    box-sizing: border-box;
    padding: 9px 15px;
    border: none;
    border-radius: 10px;
    font: inherit;
    font-size: 10.5px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.btn:hover,
.btn-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(17, 42, 33, 0.12);
}

.btn-primary,
.btn-link.btn-primary {
    background: #4a90e2;
    color: #fff;
}

.btn-success,
.btn-link.btn-success {
    background: #17a34a;
    color: #fff;
}

.btn-warning,
.btn-link.btn-warning {
    background: #f2a518;
    color: #fff;
}

.btn-danger,
.btn-link.btn-danger {
    background: #df2f2f;
    color: #fff;
}

.btn-small {
    min-width: 57px;
    min-height: 22px;
    padding: 4px 8px;
    font-size: 8.5px;
    border-radius: 7px;
}

.btn-muted,
.btn-link.btn-muted {
    background: #677789;
    color: #fff;
}

.btn-ghost,
.btn-link.btn-ghost {
    background: transparent;
    color: #4aaea8;
    min-width: auto;
    padding-inline: 10px;
    box-shadow: none;
}

.btn-ghost:hover,
.btn-link.btn-ghost:hover {
    box-shadow: none;
}

.auth-link {
    margin-top: 15px;
    text-align: center;
    font-size: 10.5px;
}

.auth-link a,
.panel-link {
    color: #4aaea8;
    text-decoration: none;
    font-weight: 700;
}

.auth-link a:hover,
.panel-link:hover {
    text-decoration: underline;
}

.notice {
    margin: 0 auto 8px;
    padding: 8px 11px;
    border-radius: 7px;
    font-size: 9.5px;
    max-width: 524px;
    text-align: center;
}

.notice-error {
    background: #ffe8e8;
    color: #9b1c1c;
    border: 1px solid #f2bcbc;
}

.notice-success {
    background: #e8fff1;
    color: #155e37;
    border: 1px solid #bfe6cf;
}

.notice-loading {
    background: #eef5ff;
    color: #1f4f91;
    border: 1px solid #c6daf8;
}

.loading-indicator {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    padding: 9px 11px;
    border-radius: 10px;
    background: rgba(238, 245, 255, 0.94);
    color: #1f4f91;
    border: 1px solid #c6daf8;
    font-size: 10px;
    font-weight: 600;
    text-align: center;
}

.loading-indicator.is-visible {
    display: flex;
}

.loading-indicator::before {
    content: "";
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(31, 79, 145, 0.2);
    border-top-color: #4a90e2;
    animation: spin 0.8s linear infinite;
    flex: 0 0 auto;
}

.dashboard-header {
    text-align: center;
    margin-bottom: 8px;
}

.dashboard-header p {
    margin-bottom: 0;
}

.dashboard-header .page-subtitle {
    font-size: 9.5px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.dashboard-panel .page-title-shared {
    font-size: clamp(19px, 1.93vw, 27px);
    margin-bottom: 5px;
}

.dashboard-panel .action-row {
    margin-bottom: 5px;
}

.dashboard-panel .action-row .btn-link.btn-primary {
    min-width: 0;
    min-height: 36px;
    padding: 8px 19px;
    font-size: 10.5px;
    border-radius: 12px;
}

.filter-bar {
    display: flex;
    gap: 8px;
    align-items: stretch;
    flex-wrap: nowrap;
    justify-content: center;
    margin: 10px 0 12px;
}

.filter-bar > * {
    flex: 0 1 auto;
}

.filter-bar select {
    min-width: 168px;
    max-width: 168px;
    padding: 7px 12px;
    font-size: 10.5px;
    border-radius: 12px;
}

.filter-bar .btn,
.filter-bar .btn-link {
    min-width: 0;
    width: auto;
}

.filter-bar .btn {
    min-width: 123px;
    min-height: 36px;
    padding: 8px 14px;
    font-size: 10.5px;
    border-radius: 12px;
}

.filter-bar .btn-link.btn-ghost {
    margin-left: 5px;
    padding-inline: 6px;
    align-self: center;
    font-size: 10.5px;
}

.section-title {
    margin: 2px 0 10px;
    text-align: center;
    font-size: 16px;
    color: #11231b;
}

.empty-state {
    text-align: center;
    font-size: 11.5px;
    color: #223c31;
    margin: 14px 0 6px;
}

.table-wrap {
    overflow-x: auto;
}

.materials-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 12px;
    overflow: hidden;
}

.materials-table thead tr {
    background: rgba(232, 241, 247, 0.95);
}

.materials-table th,
.materials-table td {
    padding: 12px 12px;
    text-align: left;
    vertical-align: middle;
    font-size: 10.5px;
    line-height: 1.28;
}

.materials-table th {
    font-size: 10.5px;
}

.materials-table tbody tr + tr {
    border-top: 1px solid #e4ece8;
}

.inline-actions {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

.dashboard-panel .btn-small {
    min-width: 69px;
    min-height: 25px;
    padding: 5px 9px;
    font-size: 8.5px;
}

.dashboard-panel .text-link {
    font-size: 10.5px;
}

.text-link {
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
}

.text-link:hover {
    text-decoration: underline;
}

.content-block {
    white-space: pre-wrap;
    line-height: 1.8;
    font-size: 11.5px;
}

.material-content h3 {
    margin: 20px 0 8px;
    color: #163b31;
    font-size: 1.05rem;
    font-weight: 600;
}

.material-content p {
    margin: 0 0 12px;
    line-height: 1.7;
}

.material-content ul {
    margin: 0 0 16px 18px;
    padding: 0;
}

.material-content li {
    margin-bottom: 6px;
    line-height: 1.65;
}

.material-preview {
    white-space: normal;
}

.notation-example {
    margin: 10px 0 16px;
}

.notation-example svg {
    display: block;
    width: min(100%, 520px);
    height: auto;
}

.meta-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 8px 19px;
    margin-bottom: 12px;
}

.meta-list p {
    margin: 0;
    font-size: 11.5px;
}

.top-link {
    margin-top: 10px;
    text-align: center;
}

.dashboard-panel .panel-link {
    font-size: 9.5px;
}

@media (max-width: 900px) {
    .page-shell {
        width: min(100% - 20px, 100%);
        margin: 10px auto 20px;
    }

    .login-container,
    .register-container,
    .page-panel {
        padding: 15px 11px;
        border-radius: 11px;
    }

    .dashboard-panel {
        max-width: none;
    }

    .dashboard-shell {
        width: min(100% - 20px, 100%);
        margin: 10px auto 20px;
    }

    .filter-bar {
        flex-wrap: wrap;
    }

    .filter-bar > * {
        flex: 1 1 calc(50% - 6px);
    }

    .meta-list {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .btn,
    .btn-link {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 600px) {
    .page-shell,
    .dashboard-shell {
        width: calc(100% - 16px);
        margin: 8px auto 16px;
    }

    .auth-wrap {
        padding: 8px 0;
    }

    .login-container,
    .register-container,
    .page-panel,
    .auth-compact,
    .dashboard-panel,
    .generator-panel {
        width: 100%;
        max-width: 100%;
        padding: 14px 10px;
        border-radius: 12px;
    }

    .page-title,
    .generator-panel .page-title {
        line-height: 1.2;
    }

    .action-row {
        flex-direction: column;
        align-items: stretch;
    }

    .form-stack input,
    .form-stack select,
    .form-stack textarea,
    .password-field,
    .password-field input {
        width: 100%;
        max-width: 100%;
    }

    .filter-bar {
        gap: 8px;
    }

    .filter-bar > * {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .filter-bar select,
    .filter-bar .btn,
    .filter-bar .btn-link,
    .action-row .btn,
    .action-row .btn-link {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .action-row form {
        width: 100%;
        margin: 0;
    }

    .action-row form .btn {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .filter-bar select {
        min-width: 0;
    }

    .materials-table th,
    .materials-table td {
        padding: 10px 8px;
    }

    .loading-indicator {
        font-size: 9.5px;
        line-height: 1.4;
    }
}

@media print {
    body {
        background: white;
    }
}
