/* =========================================================
   Patient Registration System
   Modern UI
   ========================================================= */

* {
    box-sizing: border-box;
}

:root {
    --primary: #557596;
    --primary-dark: #405d79;
    --primary-light: #eaf1f7;

    --text: #26313d;
    --text-soft: #66717d;
    --muted: #89939d;

    --background: #eef2f5;
    --card: rgba(255, 255, 255, 0.96);

    --border: #e1e6eb;
    --border-light: #edf0f3;

    --danger: #c95b5b;
    --danger-light: #fceeee;

    --success: #4f8a72;
    --success-light: #edf7f2;

    --shadow-sm:
        0 2px 8px rgba(43, 58, 72, 0.04);

    --shadow:
        0 8px 25px rgba(43, 58, 72, 0.07);

    --shadow-lg:
        0 18px 45px rgba(43, 58, 72, 0.10);

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
}


/* =========================================================
   Base
   ========================================================= */

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;

    background:
        radial-gradient(
            circle at top right,
            rgba(129, 160, 187, 0.16),
            transparent 34%
        ),
        radial-gradient(
            circle at bottom left,
            rgba(177, 193, 207, 0.18),
            transparent 32%
        ),
        linear-gradient(
            135deg,
            #f4f6f8 0%,
            #edf1f4 50%,
            #f7f8f9 100%
        );

    background-attachment: fixed;

    color: var(--text);

    font-family:
        "Vazirmatn",
        Tahoma,
        Arial,
        sans-serif;

    line-height: 1.8;

    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font-family: inherit;
}


/* =========================================================
   Topbar
   ========================================================= */

.topbar {
    height: 68px;

    background:
        rgba(255, 255, 255, 0.92);

    border-bottom: 1px solid rgba(218, 224, 230, 0.9);

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 30px;

    position: sticky;
    top: 0;
    z-index: 100;

    box-shadow:
        0 3px 15px rgba(40, 55, 70, 0.04);
}

.brand {
    font-size: 17px;
    font-weight: 800;

    color: var(--primary-dark);

    letter-spacing: -0.3px;

    display: flex;
    align-items: center;
    gap: 10px;
}

.brand::before {
    content: "";

    width: 9px;
    height: 9px;

    border-radius: 50%;

    background: var(--primary);

    box-shadow:
        0 0 0 5px rgba(85, 117, 150, 0.10);
}

.user-area {
    display: flex;
    gap: 18px;
    align-items: center;

    font-size: 13px;
}

.user-area span {
    color: var(--text-soft);

    background: #f5f7f9;

    padding: 6px 12px;

    border-radius: 20px;

    border: 1px solid var(--border-light);
}

.user-area a {
    color: var(--danger);

    padding: 6px 10px;

    border-radius: 7px;

    transition:
        background 0.2s ease,
        color 0.2s ease;
}

.user-area a:hover {
    background: var(--danger-light);
    color: #ad4444;
}


/* =========================================================
   Main Container
   ========================================================= */

.container {
    width: 100%;
    max-width: 1240px;

    margin: 0 auto;

    padding:
        32px 24px
        50px;
}


/* =========================================================
   Page Header
   ========================================================= */

.page-header {
    display: flex;

    justify-content: space-between;
    align-items: center;

    gap: 20px;

    margin-bottom: 26px;
}

.page-header h2 {
    margin: 0;

    color: #293746;

    font-size: 25px;
    font-weight: 800;

    letter-spacing: -0.5px;
}

.page-header p {
    color: var(--text-soft);

    margin: 5px 0 0;

    font-size: 13px;
}


/* =========================================================
   Cards
   ========================================================= */

.card {
    background: var(--card);

    border: 1px solid rgba(224, 229, 234, 0.9);

    border-radius: var(--radius-lg);

    padding: 26px;

    margin-bottom: 20px;

    box-shadow: var(--shadow-sm);

    transition:
        box-shadow 0.25s ease,
        transform 0.25s ease;
}

.card:hover {
    box-shadow: var(--shadow);
}

.section-title {
    margin: 0 0 22px;

    padding-bottom: 14px;

    border-bottom: 1px solid var(--border-light);

    color: #334454;

    font-size: 17px;
    font-weight: 750;

    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: "";

    width: 4px;
    height: 20px;

    border-radius: 4px;

    background: var(--primary);
}


/* =========================================================
   Buttons
   ========================================================= */

.btn {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-height: 42px;

    padding:
        8px 18px;

    border:
        1px solid #d7dde3;

    background: #fff;

    color: #465462;

    border-radius: var(--radius-sm);

    cursor: pointer;

    font-size: 13px;
    font-weight: 600;

    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        background 0.18s ease,
        border-color 0.18s ease;
}

.btn:hover {
    background: #f8fafb;

    border-color: #cbd3da;

    transform: translateY(-1px);

    box-shadow:
        0 5px 14px rgba(45, 60, 75, 0.07);
}

.btn:active {
    transform: translateY(0);
}

.btn.primary {
    background:
        linear-gradient(
            135deg,
            var(--primary),
            var(--primary-dark)
        );

    color: #fff;

    border-color: transparent;

    box-shadow:
        0 5px 15px rgba(70, 96, 122, 0.18);
}

.btn.primary:hover {
    background:
        linear-gradient(
            135deg,
            #607f9f,
            #45627e
        );

    box-shadow:
        0 7px 18px rgba(70, 96, 122, 0.24);
}

.btn.danger {
    color: var(--danger);

    background: #fff;

    border-color: #e9bebe;
}

.btn.danger:hover {
    background: var(--danger-light);

    border-color: #dfa2a2;
}

.btn.full {
    width: 100%;
}


/* =========================================================
   Forms
   ========================================================= */

.form-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 19px;
}

.full-column {
    grid-column: 1 / -1;
}

label {
    display: block;

    color: #465361;

    font-size: 13px;

    margin-bottom: 7px;

    font-weight: 650;
}

input,
select,
textarea {
    width: 100%;

    padding:
        11px 13px;

    border:
        1px solid #d9dfe5;

    border-radius: 9px;

    background:
        rgba(255, 255, 255, 0.96);

    color: var(--text);

    font-size: 13px;

    outline: none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

input:hover,
select:hover,
textarea:hover {
    border-color: #cbd3da;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);

    background: #fff;

    box-shadow:
        0 0 0 3px rgba(85, 117, 150, 0.11);
}

input::placeholder,
textarea::placeholder {
    color: #a5adb5;
}

textarea {
    min-height: 105px;

    resize: vertical;
}

input[type="file"] {
    padding: 9px 11px;

    background: #fafbfc;

    cursor: pointer;
}

input[type="file"]::file-selector-button {
    border: 0;

    background: var(--primary-light);

    color: var(--primary-dark);

    padding:
        7px 12px;

    border-radius: 7px;

    margin-left: 10px;

    cursor: pointer;

    font-family: inherit;

    font-size: 12px;

    font-weight: 600;
}


/* =========================================================
   Form Actions
   ========================================================= */

.form-actions {
    display: flex;

    justify-content: flex-start;

    align-items: center;

    gap: 10px;

    margin-top: 24px;

    margin-bottom: 30px;
}


/* =========================================================
   Tables
   ========================================================= */

.table-wrapper {
    width: 100%;

    overflow-x: auto;

    border-radius: 14px;

    border: 1px solid var(--border);

    background: #fff;

    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;

    border-collapse: separate;

    border-spacing: 0;

    overflow: hidden;
}

th,
td {
    padding:
        14px 15px;

    text-align: right;

    border-bottom:
        1px solid #e9edf0;

    white-space: nowrap;

    font-size: 13px;
}

th {
    background:
        linear-gradient(
            135deg,
            #627f9c,
            #58748f
        );

    color: #fff;

    font-size: 12px;

    font-weight: 700;

    border-bottom: none;

    letter-spacing: 0.1px;
}

th:first-child {
    border-top-right-radius: 12px;
}

th:last-child {
    border-top-left-radius: 12px;
}

tbody tr {
    background: #fff;

    transition:
        background 0.18s ease;
}

tbody tr:nth-child(even) {
    background: #f2f5f7;
}

tbody tr:hover {
    background: #eaf1f7;
}

tbody tr:last-child td {
    border-bottom: none;
}

td {
    color: #4b5966;
}

td strong {
    color: #344352;
}


/* =========================================================
   Table Actions
   ========================================================= */

.actions {
    display: flex;

    gap: 7px;

    align-items: center;
}

.icon-btn {
    width: 34px;
    height: 34px;

    padding: 0;

    border-radius: 8px;

    border: 1px solid #e0e5e9;

    display: inline-flex;

    align-items: center;
    justify-content: center;

    background: #f8fafb;

    color: #617384;

    cursor: pointer;

    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease,
        transform 0.18s ease;
}

.icon-btn:hover {
    background: var(--primary-light);

    border-color: #c9d6e1;

    color: var(--primary-dark);

    transform: translateY(-1px);
}

.icon-btn.danger {
    color: var(--danger);

    background: #fff8f8;

    border-color: #f0d4d4;
}

.icon-btn.danger:hover {
    color: #a94242;

    background: var(--danger-light);

    border-color: #e6b8b8;
}


/* =========================================================
   Empty State
   ========================================================= */

.empty {
    text-align: center;

    padding:
        75px 20px;

    color: var(--muted);

    background: rgba(255, 255, 255, 0.65);
}

.empty::before {
    content: "—";

    display: block;

    font-size: 28px;

    color: #bdc6ce;

    margin-bottom: 8px;
}


/* =========================================================
   Alerts
   ========================================================= */

.alert {
    padding:
        12px 15px;

    border-radius: 9px;

    margin-bottom: 20px;

    font-size: 13px;

    border: 1px solid transparent;
}

.alert.error {
    background: #fff0f0;

    color: #b44d4d;

    border-color: #f2cccc;
}


/* =========================================================
   Login
   ========================================================= */

.login-page {
    min-height: 100vh;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 25px;
}

.login-box {
    width: 100%;

    max-width: 420px;

    background:
        rgba(255, 255, 255, 0.97);

    border:
        1px solid rgba(224, 229, 234, 0.9);

    border-radius: 20px;

    padding: 38px;

    box-shadow: var(--shadow-lg);

    backdrop-filter: blur(12px);
}

.login-box h1 {
    margin:
        0 0 8px;

    color: #334454;

    font-size: 23px;

    text-align: center;

    font-weight: 800;
}

.login-subtitle {
    color: var(--text-soft);

    text-align: center;

    margin:
        0 0 30px;

    font-size: 13px;
}

.login-box form {
    display: flex;

    flex-direction: column;

    gap: 8px;
}

.login-box form label:not(:first-child) {
    margin-top: 10px;
}

.login-box .btn {
    margin-top: 12px;
}


/* =========================================================
   Patient Information
   ========================================================= */

.info-grid {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 16px;
}

.info-grid div {
    display: flex;

    flex-direction: column;

    gap: 3px;

    padding:
        12px 14px;

    background: #f8fafb;

    border:
        1px solid #edf0f2;

    border-radius: 9px;
}

.info-grid span,
.text-info span,
.address-grid span {
    color: var(--muted);

    font-size: 12px;
}

.info-grid strong {
    color: #3c4b58;

    font-weight: 600;

    font-size: 13px;
}

.text-info {
    margin-top: 20px;
}

.text-info p {
    color: #4e5b67;

    font-size: 13px;

    margin-top: 6px;
}


/* =========================================================
   Addresses
   ========================================================= */

.address-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 16px;
}

.address-grid > div {
    background:
        linear-gradient(
            135deg,
            #f7f9fa,
            #f2f5f7
        );

    padding: 16px;

    border-radius: 10px;

    border:
        1px solid #e8ecef;
}

.address-grid p {
    margin:
        5px 0 0;

    color: #4d5b67;

    font-size: 13px;
}


/* =========================================================
   Images
   ========================================================= */

.image-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 15px;
}

.patient-image,
.disease-image {
    width: 100%;

    max-height: 300px;

    object-fit: cover;

    border-radius: 12px;

    border:
        1px solid #e1e6ea;

    background: #f5f7f8;

    box-shadow:
        0 4px 14px rgba(40, 55, 70, 0.06);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.patient-image:hover,
.disease-image:hover {
    transform: translateY(-2px);

    box-shadow:
        0 8px 20px rgba(40, 55, 70, 0.10);
}

.disease-image {
    aspect-ratio: 1;
}


/* =========================================================
   Disease
   ========================================================= */

.disease-text {
    white-space: normal;

    background:
        linear-gradient(
            135deg,
            #f8fafb,
            #f2f5f7
        );

    padding: 16px;

    border-radius: 10px;

    border:
        1px solid #e8ecef;

    color: #4d5b67;

    font-size: 13px;
}


/* =========================================================
   Companions
   ========================================================= */

.companion {
    border:
        1px solid #e2e7eb;

    border-radius: 13px;

    padding: 20px;

    margin-bottom: 15px;

    background:
        linear-gradient(
            135deg,
            rgba(249, 250, 251, 0.95),
            rgba(245, 247, 248, 0.95)
        );

    box-shadow:
        0 3px 10px rgba(40, 55, 70, 0.03);
}

.companion-header {
    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 18px;

    padding-bottom: 12px;

    border-bottom:
        1px solid #e9edf0;
}

.companion-header h4 {
    margin: 0;

    color: #3d4d5b;

    font-size: 15px;
}


/* =========================================================
   Utility
   ========================================================= */

.muted {
    color: var(--muted);
}

.mt {
    margin-top: 20px;
}


/* =========================================================
   Scrollbar
   ========================================================= */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #eef1f3;
}

::-webkit-scrollbar-thumb {
    background: #bcc6ce;

    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9daab5;
}


/* =========================================================
   Selection
   ========================================================= */

::selection {
    background: rgba(85, 117, 150, 0.20);

    color: #304252;
}


/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1000px) {

    .info-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .image-grid {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }
}


@media (max-width: 800px) {

    .form-grid,
    .info-grid,
    .address-grid {
        grid-template-columns: 1fr;
    }

    .image-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .page-header {
        flex-direction: column;

        align-items: stretch;

        gap: 15px;
    }

    .page-header h2 {
        font-size: 21px;
    }

    .topbar {
        height: 62px;

        padding:
            0 15px;
    }

    .brand {
        font-size: 14px;
    }

    .user-area {
        gap: 7px;
    }

    .user-area span {
        display: none;
    }

    .container {
        padding:
            24px 12px
            40px;
    }

    .card {
        padding: 18px;

        border-radius: 14px;
    }

    .table-wrapper {
        border-radius: 10px;
    }

    th,
    td {
        padding:
            11px 12px;

        font-size: 12px;
    }

    .login-box {
        padding: 28px 22px;

        border-radius: 16px;
    }
}


@media (max-width: 500px) {

    .image-grid {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;

        align-items: stretch;
    }

    .form-actions .btn {
        width: 100%;
    }

    .page-header .btn {
        width: 100%;
    }

    .actions {
        gap: 5px;
    }

    .icon-btn {
        width: 32px;
        height: 32px;
    }
}