﻿* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    background: #FAFAFA;
    color: #303030;
}

/* Numbers */

body,
input,
textarea,
select,
button,
table,
th,
td,
span,
p,
label,
a,
strong {
    font-variant-numeric: lining-nums tabular-nums;
    font-feature-settings: "lnum", "tnum";
}

    input[type="number"],
    .number-input,
    .numeric-value {
        direction: ltr;
        text-align: right;
        unicode-bidi: plaintext;
    }

a {
    text-decoration: none;
    color: inherit;
}

/* Layout */

.app-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 240px 1fr;
    background: #FAFAFA;
}

.sidebar {
    background: #FFFFFF;
    border-left: 1px solid #E5E5E5;
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.main-content {
    padding: 24px;
}

/* Brand / Sidebar */

.brand {
    margin-bottom: 34px;
}

    .brand h1 {
        margin: 0;
        font-size: 25px;
        font-weight: 700;
        color: #303030;
    }

    .brand span {
        display: block;
        margin-top: 4px;
        font-size: 15px;
        font-weight: 600;
        color: #666666;
    }

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-link,
.logout-button {
    display: block;
    height: 44px;
    line-height: 44px;
    padding: 0 16px;
    border: 1px solid #E5E5E5;
    border-radius: 12px;
    background: #FFFFFF;
    font-size: 15px;
    font-weight: 600;
    color: #404040;
}

    .sidebar-link:hover {
        background: #F7F7F7;
        border-color: #DADADA;
    }

.logout-button {
    color: #B91C1C;
    text-align: center;
}

    .logout-button:hover {
        background: #FEF2F2;
        border-color: #FCA5A5;
    }

/* Page */

.page-card {
    background: #FFFFFF;
    border: 1px solid #E5E5E5;
    border-radius: 18px;
    padding: 28px;
}

.page-title {
    margin: 0;
    font-size: 31px;
    font-weight: 700;
    color: #303030;
}

.page-subtitle {
    margin: 12px 0 0;
    font-size: 17px;
    color: #666666;
}

.page-header-row,
.details-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
}

.section-title {
    margin: 0 0 16px;
    font-size: 23px;
    font-weight: 700;
    color: #303030;
}

.subsection-title {
    margin: 22px 0 14px;
    font-size: 19px;
    font-weight: 700;
    color: #404040;
}

/* Buttons */

.primary-button,
.secondary-button,
.delete-button {
    height: 44px;
    padding: 0 22px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.primary-button,
.secondary-button {
    border: 1px solid #DADADA;
    background: #FFFFFF;
    color: #404040;
}

    .primary-button:hover,
    .secondary-button:hover {
        background: #F7F7F7;
        border-color: #CFCFCF;
    }

.delete-button {
    border: 1px solid #FCA5A5;
    background: #FEF2F2;
    color: #B91C1C;
}

    .delete-button:hover {
        background: #FEE2E2;
    }

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

/* Forms */

.form-grid {
    display: grid;
    gap: 14px;
    margin-top: 28px;
}

    .form-grid label {
        font-size: 18px;
        font-weight: 600;
        color: #404040;
    }

    .form-grid input {
        height: 46px;
        border: 1px solid #DADADA;
        border-radius: 12px;
        padding: 0 14px;
        font-size: 15px;
        background: #FFFFFF;
        color: #303030;
        outline: none;
        transition: 0.2s;
    }

        .form-grid input:focus {
            border-color: #BDBDBD;
        }

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

    .checkbox-row input {
        width: 18px;
        height: 18px;
    }

/* Messages */

.success-message,
.error-message,
.empty-message {
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
}

.success-message {
    background: #F0FDF4;
    border: 1px solid #BBF7D0;
    color: #166534;
}

.error-message {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: #B91C1C;
}

.empty-message {
    background: #FAFAFA;
    border: 1px solid #ECECEC;
    color: #666666;
}

/* Cards */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.stat-card {
    background: #FFFFFF;
    border: 1px solid #E5E5E5;
    border-radius: 16px;
    padding: 20px;
}

    .stat-card span {
        display: block;
        font-size: 15px;
        font-weight: 600;
        color: #666666;
    }

    .stat-card strong {
        display: block;
        margin-top: 10px;
        font-size: 29px;
        color: #303030;
    }

/* Tables */

.table-wrapper {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #FFFFFF;
    direction: rtl;
    text-align: center;
}

    .data-table thead tr {
        background: #F8F8F8;
    }

    .data-table th,
    .data-table td {
        padding: 16px;
        font-size: 15px;
        border-bottom: 1px solid #ECECEC;
        white-space: nowrap;
        text-align: center;
    }

    .data-table th {
        font-weight: 700;
        color: #404040;
    }

    .data-table td {
        color: #505050;
    }

    .data-table tbody tr:hover {
        background: #FAFAFA;
    }

/* Pagination */

.pagination-wrapper {
    margin-top: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.pagination-button {
    min-width: 110px;
    height: 42px;
    border: 1px solid #DADADA;
    border-radius: 12px;
    background: #FFFFFF;
    color: #404040;
    font-size: 15px;
    font-weight: 600;
    line-height: 42px;
    text-align: center;
    transition: 0.2s;
}

    .pagination-button:hover {
        background: #F7F7F7;
        border-color: #CFCFCF;
    }

.pagination-info {
    font-size: 15px;
    font-weight: 600;
    color: #666666;
}

/* Castle Details */

.castle-link {
    color: #2563EB;
    font-weight: 600;
    transition: 0.2s;
}

    .castle-link:hover {
        color: #1D4ED8;
    }

.details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 20px;
}

    .details-grid div {
        background: #FAFAFA;
        border: 1px solid #ECECEC;
        border-radius: 14px;
        padding: 18px;
    }

    .details-grid span {
        display: block;
        font-size: 14px;
        color: #737373;
        margin-bottom: 10px;
    }

    .details-grid strong {
        font-size: 17px;
        color: #303030;
    }

.details-section,
.logs-section {
    margin-top: 32px;
}

/* Tabs */

.tabs-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
    margin-bottom: 24px;
}

.details-tab {
    height: 44px;
    padding: 0 20px;
    border: 1px solid #E5E5E5;
    border-radius: 12px;
    background: #FFFFFF;
    color: #505050;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

    .details-tab:hover {
        background: #F7F7F7;
    }

    .details-tab.active {
        background: #303030;
        border-color: #303030;
        color: #FFFFFF;
    }

.tab-content {
    display: none;
}

    .tab-content.active {
        display: block;
    }

/* Responsive */

@media (max-width: 900px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-left: 0;
        border-bottom: 1px solid #E5E5E5;
    }

    .cards-grid,
    .details-grid {
        grid-template-columns: 1fr;
    }

    .page-header-row,
    .details-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-actions {
        flex-wrap: wrap;
    }
}

/* ===== Auth Page ===== */

.auth-home {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

.auth-right-panel {
    width: 420px;
    text-align: center;
}

.auth-brand h1 {
    margin: 0;
    font-size: 64px;
    font-weight: 800;
    color: #5C5C5C;
    line-height: 1.2;
}

.auth-brand p {
    margin-top: 18px;
    font-size: 20px;
    color: #B8B8B8;
    line-height: 1.8;
}

.auth-open-button {
    margin-top: 32px;
    width: 100%;
    height: 68px;
    border: 1px solid #DADADA;
    border-radius: 18px;
    background: #FFFFFF;
    color: #404040;
    font-size: 22px;
    font-weight: 800;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 8px 24px rgba(0,0,0,0.05);
}

    .auth-open-button:hover {
        background: #FFFFFF;
        color: #9C9C9C;
        transform: translateY(-1px);
    }

/* Overlay */

.login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    opacity: 0;
    visibility: hidden;
    transition: 0.25s;
    z-index: 998;
}

/* Drawer */

.login-drawer {
    position: fixed;
    top: 0;
    right: -430px;
    width: 430px;
    max-width: 100%;
    height: 100vh;
    background: #FFFFFF;
    border-left: 1px solid #E5E5E5;
    padding: 34px;
    transition: 0.28s;
    z-index: 999;
    overflow-y: auto;
    box-shadow: -10px 0 40px rgba(0,0,0,0.08);
}

.login-open .login-overlay {
    opacity: 1;
    visibility: visible;
}

.login-open .login-drawer {
    right: 0;
}

/* Drawer Header */

.login-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

    .login-drawer-header h2 {
        margin: 0;
        font-size: 30px;
        font-weight: 800;
        color: #303030;
    }

.close-login-button {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 12px;
    background: #F4F4F4;
    color: #303030;
    font-size: 24px;
    cursor: pointer;
    transition: 0.2s;
}

    .close-login-button:hover {
        background: #EAEAEA;
    }

/* Login Form */

.login-submit-button {
    width: 100%;
    background: #FFFFFF;
    color: #303030;
    border: 1px solid #DADADA;
    font-size: 20px;
    font-weight: 800;
    height: 58px;
    border-radius: 16px;
}

    .login-submit-button:hover {
        background: #F7F7F7;
        border-color: #CFCFCF;
    }

/* Mobile */

@media (max-width: 700px) {
    .auth-home {
        justify-content: center;
        text-align: center;
        padding: 24px;
    }

    .auth-right-panel {
        width: 100%;
    }

    .auth-brand h1 {
        font-size: 34px;
    }

    .login-drawer {
        width: 100%;
        right: -100%;
    }
}

.login-open-overlay {
    opacity: 1;
    visibility: visible;
}

.register-drawer {
    right: 0;
}
.auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-login-button,
.auth-register-button {
    height: 62px;
    border-radius: 18px;
    font-size: 20px;
    font-weight: 800;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-login-button {
    background: #303030;
    color: #FFFFFF;
    border: 1px solid #303030;
}

.auth-register-button {
    background: #FFFFFF;
    color: #303030;
    border: 1px solid #D4D4D8;
}