﻿
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* ================================
   GLOBAL RESET
   ================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
    font-family: Arial, Helvetica, sans-serif;
}

#app {
    width: 100%;
    overflow-x: hidden;
}

/* ================================
   LAYOUT
   ================================ */
.layout-container {
    display: flex;
    width: 100%;
}

.sidebar {
    width: 240px;
    flex-shrink: 0;
}

.content-area {
    flex: 1;
    min-width: 0;
}

/* ================================
   TABLE SAFETY
   ================================ */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    white-space: nowrap;
}

/* ================================
   FORM SAFETY
   ================================ */
input,
select,
textarea,
button {
    max-width: 100%;
}

/* ================================
   PRINT VISIBILITY CONTROL
   ================================ */
.print-only {
    display: none;
}

.no-print {
    display: block;
}

/* ================================
   MAIN CONTENT BACKGROUND
   ================================ */
main, .main-content, article {
    background: #f0f4f8 !important;
}

/* ════════════════════════════════
   SIDEBAR — TEAL THEME
   ════════════════════════════════ */

/* Background */
.sidebar {
    background: linear-gradient(180deg, #0b2f3a 0%, #0e3a47 100%) !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
}

    /* Top brand bar */
    .sidebar .top-row {
        background: #071f28 !important;
        border-bottom: 1.5px solid rgba(42, 157, 143, 0.22) !important;
    }

        .sidebar .navbar-brand,
        .sidebar .top-row a {
            color: #e8f6f4 !important;
            font-weight: 700 !important;
            font-size: 0.92rem !important;
            letter-spacing: -0.2px;
            text-decoration: none !important;
        }

    /* Nav links — default */
    .sidebar .nav-item .nav-link {
        color: #8cbbc8 !important;
        font-family: 'Plus Jakarta Sans', sans-serif !important;
        font-size: 0.845rem !important;
        font-weight: 500 !important;
        border-radius: 9px !important;
        margin: 1px 8px !important;
        padding: 9px 13px !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        transition: background 0.14s, color 0.14s !important;
        text-decoration: none !important;
        line-height: 1.3 !important;
    }

        /* Hover */
        .sidebar .nav-item .nav-link:hover {
            background: rgba(42, 157, 143, 0.16) !important;
            color: #d4eeea !important;
            text-decoration: none !important;
        }

        /* Active */
        .sidebar .nav-item .nav-link.active {
            background: linear-gradient(135deg, #2a9d8f 0%, #1a7a6e 100%) !important;
            color: #ffffff !important;
            font-weight: 700 !important;
            box-shadow: 0 3px 10px rgba(42, 157, 143, 0.32) !important;
        }

    /* Divider */
    .sidebar hr {
        border-color: rgba(42, 157, 143, 0.2) !important;
        margin: 8px 16px !important;
    }

    /* Logout button — targets both old .btn-danger and new .btn-logout */
    .sidebar .btn-danger,
    .sidebar .btn-logout {
        display: block !important;
        width: calc(100% - 16px) !important;
        margin: 4px 8px 12px !important;
        padding: 9px 13px !important;
        background: rgba(230, 57, 70, 0.12) !important;
        color: #f08080 !important;
        border: 1.5px solid rgba(230, 57, 70, 0.22) !important;
        border-radius: 9px !important;
        font-family: 'Plus Jakarta Sans', sans-serif !important;
        font-size: 0.845rem !important;
        font-weight: 600 !important;
        text-align: left !important;
        cursor: pointer !important;
        transition: all 0.14s !important;
    }

        .sidebar .btn-danger:hover,
        .sidebar .btn-logout:hover {
            background: rgba(230, 57, 70, 0.24) !important;
            color: #ff9090 !important;
            border-color: rgba(230, 57, 70, 0.4) !important;
        }

    /* Scrollbar */
    .sidebar::-webkit-scrollbar {
        width: 3px;
    }

    .sidebar::-webkit-scrollbar-track {
        background: transparent;
    }

    .sidebar::-webkit-scrollbar-thumb {
        background: rgba(42, 157, 143, 0.28);
        border-radius: 3px;
    }

/* ================================
   PRINT STYLES
   ================================ */
@media print {
    body {
        font-size: 12px;
        font-family: 'Times New Roman', Times, serif;
        color: #000;
        margin: 0;
        padding: 0;
        background: #fff;
    }

        body * {
            visibility: hidden;
        }

    .print-only,
    .print-only * {
        visibility: visible;
    }

    .print-only {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        padding: 15px 20px 0 20px;
        display: block;
    }

    .no-print,
    .sidebar,
    .page-header,
    .token-bar,
    .btn,
    .alert,
    .card,
    input:not(.print-only input),
    textarea:not(.print-only textarea),
    select:not(.print-only select),
    button {
        display: none !important;
        visibility: hidden !important;
    }

    /* Prescription Header */
    .rx-header {
        display: flex;
        align-items: center;
        gap: 15px;
        margin-bottom: 10px;
    }

    .clinic-logo img {
        height: 60px;
        width: auto;
        object-fit: contain;
    }

    .clinic-logo {
        flex-shrink: 0;
    }

    .clinic-info {
        flex: 1;
    }

    .clinic-name {
        font-size: 20px;
        font-weight: bold;
        margin: 0 0 4px 0;
        color: white;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .clinic-address,
    .clinic-contact {
        font-size: 11px;
        margin: 2px 0;
        color: white;
    }

    .header-divider {
        border: none;
        border-top: 2px solid #3b82f6;
        margin: 10px 0;
    }

    .rx-info-row {
        display: flex;
        justify-content: space-between;
        margin-bottom: 10px;
        padding: 8px;
        background: #f9fafb;
        border-radius: 6px;
    }

    .info-left,
    .info-right {
        font-size: 11px;
    }

        .info-left strong,
        .info-right strong {
            font-size: 12px;
            color: #1f2937;
        }

    .patient-details {
        margin-bottom: 10px;
        padding: 8px;
        background: #f9fafb;
        border-radius: 6px;
    }

    .patient-row {
        display: flex;
        gap: 20px;
        font-size: 11px;
        margin: 4px 0;
    }

        .patient-row strong {
            color: #1f2937;
        }

    .rx-symbol {
        font-size: 28px;
        font-weight: bold;
        color: #3b82f6;
        margin: 15px 0 10px 0;
        font-family: Georgia, serif;
    }

    .rx-section {
        margin-bottom: 15px;
    }

    .section-label {
        font-weight: bold;
        font-size: 12px;
        color: #1f2937;
        margin-bottom: 6px;
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }

    .section-content {
        font-size: 11px;
        line-height: 1.6;
        padding: 8px;
        border: 1px solid #d1d5db;
        border-radius: 4px;
        background: #fefefe;
        min-height: 40px;
    }

    .medicine-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 10px;
        margin-top: 8px;
    }

        .medicine-table th {
            background: #f3f4f6;
            border: 1px solid #d1d5db;
            padding: 6px 8px;
            text-align: left;
            font-weight: bold;
            color: #1f2937;
            font-size: 10px;
        }

        .medicine-table td {
            border: 1px solid #d1d5db;
            padding: 6px 8px;
            vertical-align: top;
            color: #374151;
        }

        .medicine-table tr:nth-child(even) {
            background: #fafafa;
        }

    .rx-footer {
        margin-top: 40px;
        display: flex;
        justify-content: flex-end;
    }

    .doctor-sign {
        text-align: center;
        min-width: 200px;
    }

        .doctor-sign strong {
            font-size: 12px;
        }

    .rx-note {
        margin-top: 30px;
        border-top: 1px dashed #d1d5db;
        padding-top: 10px;
    }

        .rx-note p {
            margin: 3px 0;
            font-size: 9px;
            color: #6b7280;
            font-style: italic;
        }

    .print-footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 15px;
        padding-top: 6px;
        border-top: 1px dashed #ccc;
        font-size: 9px;
        color: #555;
        visibility: visible !important;
    }

        .print-footer * {
            visibility: visible !important;
        }

    .footer-left {
        text-align: left;
    }

    .footer-right {
        text-align: right;
    }

    .page-break {
        page-break-after: always;
    }

    .rx-section,
    .medicine-table {
        page-break-inside: avoid;
    }

    @page {
        margin: 12mm;
        size: A4;
    }

    html, body {
        height: auto;
        overflow: visible;
    }

    /*Load Text FB*/
  #app {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f7f9fc;
  }

  .cms-loader {
    text-align: center;
    font-family: Segoe UI, Arial;
  }

  .cms-logo img {
    height: 60px;
    margin-bottom: 10px;
  }

  .cms-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c7be5;
    margin-bottom: 20px;
  }

  .progress-bar {
    width: 260px;
    height: 6px;
    background: #e4e7eb;
    border-radius: 10px;
    overflow: hidden;
  }

  .progress-fill {
    height: 100%;
    width: 40%;
    background: #2c7be5;
    border-radius: 10px;
    animation: loading 1.6s infinite;
  }

  .loading-text {
    margin-top: 12px;
    font-size: 13px;
    color: #777;
  }

  @keyframes loading {
    0% {
      transform: translateX(-100%);
    }

    100% {
      transform: translateX(300%);
    }
  }
}

@media screen {
    .print-only {
        display: none;
    }

    .no-print {
        display: block;
    }

    /* ── Loading Screen ── */
    #app:has(.cms-loader) {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 100vh;
        background: #f2f6f8;
    }

    .cms-loader {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 16px;
    }

    .cms-logo img {
        width: 120px;
        height: 120px;
        object-fit: contain;
        animation: pulse 1.8s ease-in-out infinite;
    }

    @keyframes pulse {
        0% {
            transform: scale(1);
            opacity: 1;
        }

        50% {
            transform: scale(1.08);
            opacity: 0.75;
        }

        100% {
            transform: scale(1);
            opacity: 1;
        }
    }

    .loading-text {
        font-family: 'Plus Jakarta Sans', sans-serif;
        font-size: 0.88rem;
        font-weight: 600;
        color: #2a9d8f;
        letter-spacing: 0.5px;
        animation: blink 1.5s ease-in-out infinite;
    }

    @keyframes blink {
        0%, 100% {
            opacity: 1;
        }

        50% {
            opacity: 0.4;
        }
    }
}
