/*
Theme Name: MedSet Order Tracking Portal
Theme URI: https://medsetpharma.com
Author: MedSet Pharma
Description: Premium order tracking portal with custom post types, ACF integration, role-based access, and modern responsive dashboard.
Version: 2.2.0
Requires at least: 5.8
Tested up to: 6.4
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: medset-portal
*/

/* ============================================================================
   GLOBAL STYLES
   ============================================================================ */
html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
}

body .site-content,
body .medset-dashboard,
body .medset-login-prompt {
    flex: 1;
}

/* Override WordPress default content width constraints */
body .site-content,
body .entry-content,
body .site-main,
body .content-area,
body .site,
body .page-template-page-dashboard .site-content,
body .page-template-page-dashboard .entry-content,
body .page-template-page-dashboard .site-main,
body.page-template-page-dashboard .wp-site-blocks,
body.page-template-page-dashboard .wp-block-group,
body.page-template-page-dashboard .wp-block-post-content {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Ensure header and banner are always full width */
.medset-header,
.medset-banner {
    width: 100%;
}

/* ============================================================================
   HEADER & BANNER
   ============================================================================ */
.medset-header { background: #ffffff; border-bottom: 3px solid #008C45; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.medset-header-inner { max-width: 1400px; margin: 0 auto; padding: 12px 24px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.medset-logo-link { display: flex; align-items: center; text-decoration: none; }
.medset-logo-link img { max-height: 55px; width: auto; }
.medset-header-right { display: flex; align-items: center; gap: 20px; }
.medset-welcome { font-size: 0.9rem; color: #333; font-weight: 500; }
.medset-welcome strong { color: #008C45; }
.medset-logout-btn { display: inline-block; padding: 8px 18px; background: #E30613; color: #fff; text-decoration: none; font-size: 0.85rem; border-radius: 6px; font-weight: 600; transition: all 0.2s; }
.medset-logout-btn:hover { background: #c00510; transform: translateY(-1px); }

.medset-banner { background: linear-gradient(135deg, #008C45 0%, #006633 100%); color: #fff; padding: 20px 24px; text-align: center; }
.medset-banner-inner { max-width: 1400px; margin: 0 auto; }
.medset-banner h2 { margin: 0 0 6px 0; font-size: 1.4rem; font-weight: 700; }
.medset-banner p { margin: 0; font-size: 0.9rem; opacity: 0.9; }

/* ============================================================================
   DASHBOARD CONTAINER
   ============================================================================ */
.medset-dashboard { width: 100%; max-width: 1400px; margin: 0 auto; padding: 24px; box-sizing: border-box; }

/* ============================================================================
   STATS ROW
   ============================================================================ */
.medset-stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 32px; }
@media (max-width: 768px) { .medset-stats-row { grid-template-columns: 1fr; } }
.medset-stat-card { background: #fff; border-radius: 12px; padding: 20px 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); border-left: 4px solid #008C45; display: flex; align-items: center; gap: 16px; }
.medset-stat-card.warning { border-left-color: #f97316; }
.medset-stat-card.danger { border-left-color: #E30613; }
.medset-stat-card.info { border-left-color: #2563eb; }
.medset-stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: #e6f4ea; }
.medset-stat-card.warning .medset-stat-icon { background: #fff3e0; }
.medset-stat-card.danger .medset-stat-icon { background: #fce4ec; }
.medset-stat-card.info .medset-stat-icon { background: #e3f2fd; }
.medset-stat-number { font-size: 1.75rem; font-weight: 800; color: #111; line-height: 1; }
.medset-stat-label { font-size: 0.8rem; color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; margin-top: 4px; }

/* ============================================================================
   PROFILE CARD
   ============================================================================ */
.medset-profile-card { background: #fff; border-radius: 12px; padding: 28px 32px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-bottom: 32px; border: 1px solid #e5e7eb; }
.medset-profile-card h3 { margin: 0 0 20px 0; color: #111; font-size: 1.15rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.medset-profile-card h3::before { content: ''; width: 4px; height: 20px; background: #008C45; border-radius: 2px; }
.medset-profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.medset-profile-item { background: #f8f9fa; border-radius: 8px; padding: 16px; border: 1px solid #e5e7eb; }
.medset-profile-label { font-size: 0.75rem; color: #6b7280; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; display: block; margin-bottom: 8px; }
.medset-profile-value { font-size: 1rem; color: #111; font-weight: 600; display: block; word-break: break-word; }

/* ============================================================================
   SEARCH & FILTER BAR
   ============================================================================ */
.medset-toolbar { background: #fff; border-radius: 12px; padding: 16px 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-bottom: 24px; display: flex; gap: 20px; flex-wrap: nowrap; align-items: center; border: 1px solid #e5e7eb; }
.medset-search-box { flex: 1; min-width: 0; position: relative; }
.medset-search-box input { width: 100%; padding: 10px 16px 10px 40px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 0.9rem; transition: border-color 0.2s; box-sizing: border-box; }
.medset-search-box input:focus { outline: none; border-color: #008C45; box-shadow: 0 0 0 3px rgba(0,140,69,0.1); }
.medset-search-box::before { content: ''; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E") no-repeat center; z-index: 1; }
.medset-filter-select { padding: 10px 36px 10px 16px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 0.9rem; background: #fff; cursor: pointer; width: 200px; min-width: 200px; flex-shrink: 0; box-sizing: border-box; appearance: auto; }
.medset-filter-select:focus { outline: none; border-color: #008C45; }
@media (max-width: 640px) { .medset-toolbar { flex-wrap: wrap; } .medset-filter-select { width: 100%; min-width: 100%; } }

/* ============================================================================
   SECTION TITLES
   ============================================================================ */
.medset-section-title { font-size: 1.3rem; font-weight: 700; color: #111; margin: 32px 0 20px 0; display: flex; align-items: center; gap: 12px; }
.medset-section-title::before { content: ''; width: 4px; height: 24px; background: #008C45; border-radius: 2px; }
.medset-section-count { background: #008C45; color: #fff; font-size: 0.75rem; padding: 3px 10px; border-radius: 12px; font-weight: 700; }

/* ============================================================================
   CURRENT ORDER CARDS
   ============================================================================ */
.medset-order-card { background: #fff; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-bottom: 20px; overflow: hidden; border: 1px solid #e5e7eb; transition: all 0.2s; }
.medset-order-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.1); transform: translateY(-2px); }
.medset-order-header { background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%); padding: 18px 24px; border-bottom: 1px solid #e5e7eb; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.medset-order-number { font-size: 1.15rem; font-weight: 700; color: #111; }
.medset-order-date { font-size: 0.85rem; color: #6b7280; margin-top: 4px; }
.medset-order-body { padding: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 900px) { .medset-order-body { grid-template-columns: 1fr; } }

/* ============================================================================
   STATUS BADGES
   ============================================================================ */
.medset-status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.medset-status-item { display: flex; flex-direction: column; gap: 6px; }
.medset-status-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: #6b7280; font-weight: 700; }
.medset-status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 20px; font-size: 0.8rem; font-weight: 700; color: #fff; }
.medset-status-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.6); }

/* ============================================================================
   TIMELINE
   ============================================================================ */
.medset-timeline { position: relative; padding-left: 32px; }
.medset-timeline::before { content: ''; position: absolute; left: 11px; top: 10px; bottom: 10px; width: 2px; background: linear-gradient(to bottom, #008C45, #e5e7eb); }
.medset-timeline-item { position: relative; margin-bottom: 18px; }
.medset-timeline-item:last-child { margin-bottom: 0; }
.medset-timeline-dot { position: absolute; left: -32px; top: 2px; width: 22px; height: 22px; border-radius: 50%; border: 3px solid #fff; z-index: 1; box-shadow: 0 0 0 2px #d1d5db; background: #f3f4f6; }
.medset-timeline-dot.active { background: #008C45; box-shadow: 0 0 0 2px #008C45; }
.medset-timeline-dot.active::after { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.medset-timeline-content { font-size: 0.85rem; color: #374151; line-height: 1.5; }
.medset-timeline-content strong { color: #111; display: block; margin-bottom: 2px; font-size: 0.9rem; }

/* ============================================================================
   PDF DOWNLOAD BUTTONS
   ============================================================================ */
.medset-pdf-link { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; background: #e6f4ea; color: #008C45; border-radius: 8px; text-decoration: none; font-size: 0.85rem; font-weight: 600; transition: all 0.2s; border: 1px solid #b7e1cd; }
.medset-pdf-link:hover { background: #008C45; color: #fff; transform: translateY(-1px); }
.medset-details-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-top: 20px; padding-top: 20px; border-top: 1px solid #e5e7eb; }
.medset-detail-item { display: flex; flex-direction: column; gap: 6px; }
.medset-detail-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: #6b7280; font-weight: 700; }

/* ============================================================================
   PAST ORDERS - 3 COLUMN GRID
   ============================================================================ */
.medset-past-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 1024px) { .medset-past-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .medset-past-grid { grid-template-columns: 1fr; } }

.medset-past-card { background: #fff; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); border: 1px solid #e5e7eb; overflow: hidden; cursor: pointer; transition: all 0.2s; }
.medset-past-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.1); transform: translateY(-3px); border-color: #008C45; }
.medset-past-card-header { background: linear-gradient(135deg, #008C45 0%, #006633 100%); color: #fff; padding: 16px 20px; }
.medset-past-card-title { font-size: 1rem; font-weight: 700; margin: 0 0 4px 0; }
.medset-past-card-subtitle { font-size: 0.8rem; opacity: 0.85; }
.medset-past-card-body { padding: 16px 20px; }
.medset-past-card-status { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.medset-past-card-badge { background: #008C45; color: #fff; padding: 4px 12px; border-radius: 12px; font-size: 0.75rem; font-weight: 700; }
.medset-past-card-days { background: #2563eb; color: #fff; padding: 4px 12px; border-radius: 12px; font-size: 0.75rem; font-weight: 700; }
.medset-past-card-date { font-size: 0.8rem; color: #6b7280; }
.medset-past-card-expand { display: flex; align-items: center; justify-content: center; padding: 12px; background: #f8f9fa; border-top: 1px solid #e5e7eb; font-size: 0.8rem; color: #008C45; font-weight: 600; gap: 6px; transition: background 0.2s; }
.medset-past-card:hover .medset-past-card-expand { background: #e6f4ea; }

/* ============================================================================
   PAST ORDER MODAL
   ============================================================================ */
.medset-modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 9999; justify-content: center; align-items: center; padding: 20px; }
.medset-modal-overlay.active { display: flex; }
.medset-modal { background: #fff; border-radius: 16px; max-width: 800px; width: 100%; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.medset-modal-header { background: linear-gradient(135deg, #008C45 0%, #006633 100%); color: #fff; padding: 24px 28px; display: flex; justify-content: space-between; align-items: center; border-radius: 16px 16px 0 0; }
.medset-modal-header h3 { margin: 0; font-size: 1.2rem; font-weight: 700; }
.medset-modal-close { background: rgba(255,255,255,0.2); border: none; color: #fff; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; transition: background 0.2s; }
.medset-modal-close:hover { background: rgba(255,255,255,0.3); }
.medset-modal-body { padding: 28px; }

/* ============================================================================
   EMPTY STATES & PROMPTS
   ============================================================================ */
.medset-no-data { color: #6b7280; font-style: italic; padding: 40px 24px; background: #f8f9fa; border-radius: 12px; text-align: center; border: 2px dashed #d1d5db; }

.medset-login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
    padding: 40px 20px;
}

.medset-login-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 40px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 140, 69, 0.15), 0 2px 10px rgba(0, 0, 0, 0.08);
    max-width: 500px;
    width: 100%;
    border: 2px solid #e8f5e9;
    position: relative;
    overflow: hidden;
}

.medset-login-prompt::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #008C45 0%, #00a854 50%, #008C45 100%);
}

.medset-login-prompt h2 {
    color: #008C45;
    margin: 0 0 16px 0;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.medset-login-prompt p {
    color: #555;
    margin: 0 0 32px 0;
    font-size: 16px;
    line-height: 1.6;
}

.medset-login-btn {
    display: inline-block;
    padding: 14px 36px;
    background: linear-gradient(135deg, #E30613 0%, #c00510 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(227, 6, 19, 0.3);
    letter-spacing: 0.3px;
}

.medset-login-btn:hover {
    background: linear-gradient(135deg, #c00510 0%, #a0040e 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(227, 6, 19, 0.4);
}

/* ============================================================================
   FOOTER
   ============================================================================ */
.medset-footer {
    background: #1a1a1a;
    color: #9ca3af;
    padding: 32px 24px;
    margin-top: auto;
    text-align: center;
    flex-shrink: 0;
}

.medset-footer-inner { max-width: 1400px; margin: 0 auto; }
.medset-footer p { margin: 0 0 8px 0; font-size: 0.85rem; }
.medset-footer a { color: #008C45; text-decoration: none; }