@font-face {
    font-family: 'IBMPlexSansArabic';
    src: url('../fonts/IBMPlexSansArabic-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IBMPlexSansArabic';
    src: url('../fonts/IBMPlexSansArabic-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IBMPlexSansArabic';
    src: url('../fonts/IBMPlexSansArabic-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Font - IBM Plex Sans Arabic */
    --font-primary: 'IBMPlexSansArabic', sans-serif;
    --font-weight-regular: 400;
    --font-weight-bold: 700;

    /* Professional Blue Color Palette (No Gradients) */
    --primary-color: #0056b3;
    --primary-rgb: 0, 86, 179;
    --primary-light: #e7f1ff;
    --primary-soft: #cfe2ff;
    --primary-dark: #004085;
    --primary-hover: #004494;

    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --card-bg-blurred: rgba(255, 255, 255, 0.8);
    --text-color: #1a1e21;
    --text-muted: #5f666d;
    --border-color: #d1d9e0;

    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0ca5e9;

    --header-bg: #ffffff;
    --header-text: #0056b3;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --border-radius: 12px;

    /* Hierarchical Backgrounds (Light Mode) */
    --task-level-0: #e2e8f0;
    --task-level-1: #f1f5f9;
    --task-level-2: #f8fafc;
    --task-level-3: #ffffff;
    --surface-bg: #f8f9fa;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark-mode {
    --bg-color: #0b0e11;
    --card-bg: #1e293b;
    --card-bg-blurred: rgba(30, 41, 59, 0.8);
    --surface-bg: #0f172a;
    --text-color: #c9d1d9;
    --text-muted: #8b949e;
    --border-color: #30363d;

    --primary-color: #4489da;
    --primary-rgb: 68, 137, 218;
    --primary-light: #162a44;
    --primary-dark: #122133;

    --header-bg: #161b22;
    --header-text: #58a6ff;
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);

    /* Hierarchical Backgrounds (Dark Mode) */
    --task-level-0: #0f172a;
    --task-level-1: #1e293b;
    --task-level-2: #334155;
    --task-level-3: #475569;
}

.logo-dark {
    display: none;
}

.dark-mode .logo-light {
    display: none;
}

.dark-mode .logo-dark {
    display: block;
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-primary);
    font-weight: var(--font-weight-regular);
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.4s ease, color 0.4s ease;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    width: 100% !important;
    margin: 0 auto;
    padding: 20px 5%;
}


/* Professional Header */
/* Modern Floating Header */
header.glass-header {
    background: var(--card-bg-blurred);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    position: sticky;
    top: 10px;
    z-index: 1000;
    padding: 8px 0;
    margin: 10px 12px 15px 12px;
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

@media (max-width: 480px) {
    header.glass-header {
        top: 10px;
        margin: 0 10px 15px 10px;
        padding: 8px 0;
        border-radius: 15px;
    }
}

.dark-mode header.glass-header {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.header-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

@media (max-width: 480px) {
    .header-container {
        padding: 0 15px;
    }
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-back {
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
    color: var(--primary-color);
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-back:hover {
    background: var(--primary-color);
    color: white;
    transform: translateX(4px);
    /* Animate towards RTL direction back */
}

.logo img {
    height: 48px;
    width: auto;
    object-fit: contain;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

@media (max-width: 480px) {
    .nav-actions {
        gap: 8px;
    }

    .logo img {
        height: 36px;
    }
}

.nav-actions a,
.nav-actions button,
.theme-toggle {
    text-decoration: none;
    color: var(--text-color);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    font-size: 1rem;
}

.nav-actions a:hover,
.nav-actions button:hover,
.theme-toggle:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

/* Breadcrumb */
.breadcrumb {
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s;
}

.breadcrumb a:hover {
    color: var(--primary-color);
}

.breadcrumb .sep {
    margin: 0 8px;
    opacity: 0.5;
}

.breadcrumb .curr {
    color: var(--text-color);
    font-weight: 700;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    gap: 20px;
}

.section-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 5px;
}

.section-header .subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}

.stats-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding: 15px 25px;
    background: var(--card-bg-blurred);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 85px;
    z-index: 100;
    transition: all 0.3s ease;
}

.stat-item span {
    color: var(--text-color);
}

/* Color logic for total variations */
.stat-item .total-changes.positive,
.stat-item .total-changes.positive .count {
    color: var(--danger-color);
}

.stat-item .total-changes.negative,
.stat-item .total-changes.negative .count {
    color: var(--success-color);
}

@media (max-width: 600px) {
    .stats-bar {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        padding: 12px 10px;
        gap: 10px;
        top: 70px;
        text-align: center;
        border-radius: 18px;
    }

    .stat-item {
        flex-direction: column;
        gap: 4px !important;
        font-size: 0.8rem;
    }

    .stat-item i {
        font-size: 1.2rem !important;
        margin-bottom: 2px;
        color: var(--primary-color);
    }

    .stat-item .count {
        font-size: 1.25rem !important;
        font-weight: 800;
        margin-right: 0 !important;
        margin-left: 0 !important;
    }

    .stat-item .total-changes {
        display: inline-flex;
        justify-content: space-between;
        padding: 2px 5px;
    }




    .stat-item span:not(.count) {
        display: block;
        opacity: 0.8;
        font-weight: 700;
        font-size: 0.6rem;
    }
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-color);
    font-weight: 600;
}

.stat-item i {
    font-size: 1.2rem;
    color: var(--primary-color);
    opacity: 0.9;
}

.stat-item .count {
    font-weight: 800;
    font-size: 1.35rem;
}

.stat-item i {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.stat-item .count {
    font-weight: 800;
    font-size: 1.2rem;
}

.stat-item .percentage {
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.9rem;
}

@media (max-width: 600px) {
    .stats-bar {
        padding: 10px 15px;
        gap: 10px;
        top: 70px;
        flex-wrap: wrap;
    }


}

/* Journey Summary Hero */
.summary-hero {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2.5rem;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.summary-hero-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

/* Buttons & Interactive Elements */
.theme-toggle {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--text-color);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 22px;
    border-radius: var(--border-radius);
    cursor: pointer;
    border: 1px solid transparent;
    font-size: 1rem;
    font-family: var(--font-primary);
    font-weight: 500;
    transition: all 0.2s ease;
    gap: 8px;
    background: var(--primary-color);
    color: #ffffff;
    text-decoration: none;
}

.btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background-color: var(--primary-color);
    color: #ffffff;
}

@media (max-width: 480px) {
    .btn {
        padding: 8px 18px;
        font-size: 0.9rem;
    }
}

.btn-outline {
    background-color: transparent;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-light);
}

.btn-danger {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
    border-color: rgba(220, 53, 69, 0.2);
}

.btn-danger:hover {
    background-color: var(--danger-color);
    color: white;
}

.btn-success {
    background-color: rgba(25, 135, 84, 0.1);
    color: var(--success-color);
    border-color: rgba(25, 135, 84, 0.2);
}

.btn-success:hover {
    background-color: var(--success-color);
    color: white;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
}

.add-btn-large {
    padding: 15px;
    font-size: 1rem;
    margin-bottom: 20px;
    width: 100%;
    border-radius: 12px;
}

/* Professional Solid Cards */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 20px;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    position: relative;
}

.card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border-color: var(--primary-color);
    transform: translateY(-6px);
}

.card-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
}

.card-header i {
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* Grids */
.grid-dashboard {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 1024px) {
    .grid-dashboard {
        grid-template-columns: 1fr 400px;
    }
}

.left-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    order: 2;
    /* Mobile: History after goal */
}

.right-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    order: 1;
    /* Mobile: Goal first */
}

@media (min-width: 1024px) {
    .left-column {
        order: 1;
    }

    .right-column {
        order: 2;
    }
}

@media (max-width: 468px) {
    .wc-weight {
        font-size: 1.3rem !important;
    }

    .wc-weight small {
        font-size: 0.6rem !important;
    }
}

/* Stats & Indicators */
.journey-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
}

/* Stats Items */
.stat-card {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 18px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

.stat-card h3 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-color);
}

.stat-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.stat-item {
    background: var(--bg-color);
    padding: 1.25rem;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.stat-item:hover {
    transform: scale(1.05);
    background: var(--surface-color);
}

.stat-item h3 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-color);
}

.stat-item p {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.stat-change {
    font-weight: 700;
    font-size: 0.95rem;
    margin-top: 8px;
    display: inline-block;
    padding: 4px 10px;
    border-radius: 8px;
}

.stat-change.positive {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.stat-change.negative {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

/* Progress & Goals */
.goal-stats {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.goal-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    background: var(--bg-color);
    border-radius: 14px;
    border: 1px solid var(--border-color);
}

.goal-item h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    letter-spacing: -1px;
}

.goal-item .label-group {
    text-align: right;
}

.goal-item p {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.goal-remaining {
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.goal-remaining.positive {
    color: var(--danger-color);
}

.goal-remaining.negative {
    color: var(--success-color);
}

/* List Items (Weights) */
.weight-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.weight-card {
    background: var(--task-level-0);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    /* More rounded */
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.wc-main-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 15px;
    min-width: 0;
}

@media (max-width: 480px) {
    .weight-card {
        padding: 12px 14px;
        border-radius: 14px;
    }
}

.weight-card:hover {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    border-color: var(--primary-color);
}

.weight-card.today {
    border-right: 4px solid var(--primary-color);
}

.wc-date {
    text-align: center;
    min-width: 65px;
    border-left: 2px solid var(--primary-color);
    padding-left: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.wc-date-day-name {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: -2px;
}

.wc-date-day {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--primary-color);
    line-height: 1;
}

.wc-date-full {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 2px;
}

.wc-data {
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: 20px;
    padding-right: 5px;
}

.wc-weight {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-color);
}

.wc-improvement {
    font-weight: 800;
    padding: 6px 12px;
    margin-left: 10px;
    border-radius: 10px;
    font-size: 0.85rem;
}

.wc-improvement.positive {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

.wc-improvement.negative {
    background: rgba(25, 135, 84, 0.1);
    color: var(--success-color);
}

.wc-improvement.neutral {
    background: rgba(95, 102, 109, 0.1);
    color: var(--text-muted);
}

/* Inputs & Forms */
.form-card {
    background: var(--card-bg-blurred);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 28px;
    margin-bottom: 30px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.form-card:hover {
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.08);
}

@media (max-width: 480px) {
    .form-card {
        padding: 18px;
        border-radius: 16px;
    }
}

.input-group label,
.form-card label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
}

.input-group input,
.input-group textarea,
.form-card input,
.form-card textarea {
    width: 100%;
    padding: 14px 20px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: var(--surface-bg);
    color: var(--text-color);
    font-size: 1rem;
    font-family: var(--font-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.dark-mode .input-group input,
.dark-mode .form-card input,
.dark-mode .form-card textarea {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Custom Date Icon Styling */
[type="date"]::-webkit-calendar-picker-indicator {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%230056b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
    cursor: pointer;
    padding: 2px;
    transition: var(--transition);
}

.dark-mode [type="date"]::-webkit-calendar-picker-indicator {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%234489da' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
}

[type="date"]::-webkit-calendar-picker-indicator:hover {
    transform: scale(1.1);
}

.input-group input:focus,
.input-group textarea:focus,
.form-card input:focus,
.form-card textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-light), inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

/* Buttons */
.btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    font-size: 1.05rem;
    font-weight: 800;
    border-radius: 12px;
    transition: var(--transition);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background: #E2E8F0;
    color: #475569;
}

.btn-secondary:hover {
    background: #CBD5E1;
    color: #1E293B;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #0c8a60;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: auto;
    flex-grow: 1;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 14px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    transition: var(--transition);
    text-align: center;
    font-family: var(--font-primary);
}

.btn-reset:hover {
    background: color-mix(in srgb, var(--danger-color) 10%, transparent);
    color: var(--danger-color);
    border-color: color-mix(in srgb, var(--danger-color) 40%, transparent);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 40px;
    background: var(--surface-bg);
    border: 2px dashed var(--border-color);
    border-radius: 20px;
}

.empty-state i {
    font-size: 3.5rem;
    color: var(--primary-color);
    opacity: 0.3;
    margin-bottom: 20px;
}

.empty-state p {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* --- High-End "Pro" Modal System --- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    transition: backdrop-filter 0.3s ease, -webkit-backdrop-filter 0.3s ease;
}

.modal.show .modal-overlay {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-container {
    background: var(--card-bg);
    width: 92%;
    max-width: 520px;
    border-radius: 28px;
    position: relative;
    z-index: 2001;
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(30px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal.show .modal-container {
    transform: translateY(0) scale(1);
}

.modal-header {
    padding: 24px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface-bg);
}

.modal-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-header h2 i {
    color: var(--primary-color);
}

.btn-close-modal {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.btn-close-modal:hover {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

.modal-body {
    padding: 30px;
    max-height: 80vh;
    overflow-y: auto;
    overflow-x: hidden;
    word-break: break-word;
    width: 100%;
    box-sizing: border-box;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--surface-bg);
}

/* Pro Form Elements within Modals */
.form-group {
    margin-bottom: 22px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-color);
}

.form-group label i {
    font-size: 1rem;
    color: var(--primary-color);
    opacity: 0.8;
}

.pro-input {
    width: 100%;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 14px 18px;
    font-family: var(--font-primary);
    font-size: 1.05rem;
    color: var(--text-color);
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.pro-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--card-bg);
    box-shadow: 0 0 0 4px var(--primary-light), inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.pro-input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

textarea.pro-input {
    min-height: 100px;
    resize: vertical;
}

.swal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 600px) {
    .swal-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        max-width: 95%;
        margin: 10px;
        transform: translateY(20px) scale(0.95);
    }

    .modal.show .modal-container {
        transform: translateY(0) scale(1);
    }
}

.wc-note {
    margin-top: 15px;
    font-size: 0.88rem;
    color: var(--text-color);
    background: rgba(var(--primary-rgb), 0.04);
    padding: 10px 14px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    /* Center items vertically */
    gap: 10px;
    border: 1px solid rgba(var(--primary-rgb), 0.1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
    line-height: 1.5;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    min-height: 48px;
    /* Ensure a consistent base height */
}

.wc-note:hover {
    background: rgba(var(--primary-rgb), 0.08);
    border-color: rgba(var(--primary-rgb), 0.2);
    transform: translateY(-1px);
}

.wc-note-text {
    flex-grow: 1;
    min-width: 0;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    /* Standard property */
    -webkit-box-orient: vertical;
    overflow: hidden;
    /* Truncation Dots */
    text-overflow: ellipsis;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-all;
    /* Prevents long words from breaking layout */
    color: var(--text-color);
    font-weight: 600;
    line-height: 1.5;
    max-height: 1.5em;
    /* 1 line * 1.5 line-height */
}

.wc-note-empty {
    opacity: 0.5;
    font-weight: normal;
    font-style: italic;
}

.wc-note-improvement {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 12px;
    margin-right: 5px;
    border-right: 1px solid var(--border-color);
    font-weight: 800;
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
    height: 1.5em;
}

.wc-note-improvement i {
    font-size: 0.75rem;
    background: none !important;
    width: auto !important;
    height: auto !important;
    box-shadow: none !important;
}

.wc-note-improvement.positive {
    color: var(--danger-color);
}

.wc-note-improvement.negative {
    color: var(--success-color);
}

.wc-note-improvement.neutral {
    color: var(--text-muted);
}


.dark-mode .wc-note {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: rgba(var(--primary-rgb), 0.2);
}

.wc-note i {
    font-size: 0.9rem;
    opacity: 0.9;
    background: white;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.dark-mode .wc-note i {
    background: var(--card-bg);
}




/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Action Dropdown Styles */
.actions-dropdown {
    position: relative;
    display: inline-block;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(37, 99, 235, 0.15);
    color: var(--primary-color);
    transform: scale(1.1);
}

.dropdown-content {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    background-color: var(--card-bg);
    min-width: 140px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    z-index: 1000;
    overflow: hidden;
    animation: fadeIn 0.15s ease-out;
}

.dropdown-content.show {
    display: block;
}

.dropdown-item {
    padding: 12px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-primary);
    border: none;
    background: none;
    width: 100%;
    text-align: right;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background-color: var(--primary-color);
    color: white;
}

.dropdown-item.delete:hover {
    background-color: var(--danger-color);
    color: white;
}

.dropdown-item i {
    width: 16px;
}

.dropdown-item.delete {
    color: var(--danger-color);
}

/* SweetAlert Custom Styles */
.swal2-popup {
    background: var(--card-bg) !important;
    color: var(--text-color) !important;
    border-radius: 24px !important;
    border: 1px solid var(--border-color) !important;
    padding: 1.5rem !important;
}

.swal2-title {
    color: var(--text-color) !important;
    font-family: var(--font-family) !important;
    font-weight: 800 !important;
}

.swal2-html-container {
    color: var(--text-muted) !important;
    font-family: var(--font-family) !important;
    font-weight: 600 !important;
    padding: 0 !important;
}

.swal2-input,
.swal2-select,
.swal2-textarea {
    background: var(--bg-color) !important;
    color: var(--text-color) !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 12px !important;
    font-family: var(--font-family) !important;
    box-shadow: none !important;
    padding: 0 1rem !important;
    height: 3.5rem !important;
    text-align: center !important;
    margin: 0.5rem auto 0 !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
}

.swal2-input[type="date"] {
    cursor: pointer;
}

.swal2-input:focus,
.swal2-textarea:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
}

.swal2-styled.swal2-confirm {
    background-color: var(--primary-color) !important;
    border-radius: 14px !important;
    font-weight: 800 !important;
    padding: 12px 24px !important;
    font-family: var(--font-family) !important;
}

.swal2-styled.swal2-cancel {
    background-color: var(--text-muted) !important;
    border-radius: 14px !important;
    font-weight: 800 !important;
    padding: 12px 24px !important;
    font-family: var(--font-family) !important;
}

.dark-mode .swal2-timer-progress-bar {
    background: var(--primary-color) !important;
}

/* Responsive Grid for SweetAlert Forms */
.swal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 600px) {
    .swal-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Measurements Hero Grid */
.measurements-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

@media (min-width: 600px) {
    .measurements-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.measurement-item {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.measurement-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-3px);
}

.measurement-item i {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 1.1rem;
}

.measurement-item .label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 700;
    opacity: 0.8;
    margin-bottom: 2px;
}

.measurement-item .value {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    letter-spacing: -0.5px;
}

.measurement-item .value small {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-right: 2px;
}

/* Measurements Table & Responsive Cards */
.table-responsive {
    overflow-x: auto;
    margin-top: 1rem;
}

.history-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    margin-top: -8px;
}

.history-table th {
    background: transparent;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    padding: 12px 1rem;
    text-align: center;
}

.history-table td {
    background: var(--bg-color);
    padding: 1rem;
    text-align: center;
    font-weight: 700;
    color: var(--text-color);
    transition: var(--transition);
}

.history-table tr td:first-child {
    border-radius: 0 12px 12px 0;
}

.history-table tr td:last-child {
    border-radius: 12px 0 0 12px;
}

.history-table tr:hover td {
    background: var(--surface-color);
    color: var(--primary-color);
}

.history-table td small {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-right: 2px;
}

/* Action Buttons in Table */
.action-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.action-btn.edit {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.action-btn.edit:hover {
    background: var(--primary-color);
    color: white;
}

.action-btn.delete {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.action-btn.delete:hover {
    background: var(--danger-color);
    color: white;
}

/* Mobile Responsive Table (Cards) */
@media (max-width: 991px) {
    .history-table thead {
        display: none;
    }

    .history-table,
    .history-table tbody,
    .history-table tr,
    .history-table td {
        display: block;
        width: 100%;
    }

    .history-table tr {
        margin-bottom: 1.5rem;
        background: var(--bg-color);
        border-radius: 16px;
        padding: 1.25rem;
        border: 1px solid var(--border-color);
        box-shadow: var(--shadow-sm);
    }

    .history-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
        padding: 0.85rem 0.5rem;
        background: transparent !important;
        border-bottom: 1px solid var(--border-color);
    }

    .history-table td:last-child {
        border-bottom: none;
        justify-content: center;
        padding-top: 1.25rem;
    }

    .history-table td:first-child {
        border-radius: 0;
        font-size: 1.15rem;
        color: var(--primary-color);
        border-bottom: 2px solid var(--primary-color);
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
        justify-content: center;
    }

    .history-table td::before {
        content: attr(data-label);
        font-weight: 800;
        text-transform: uppercase;
        font-size: 0.8rem;
        color: var(--text-muted);
    }

    .history-table td:first-child::before {
        display: none;
    }

    .history-table td:last-child::before {
        display: none;
    }

    .history-table tr td:first-child,
    .history-table tr td:last-child {
        border-radius: 0;
    }
}