/* ================================================================
 *  KUDDESOFT LIVESTOCK MANAGEMENT - MODERN MINIMALIST DESIGN
 *  Version: 4.0 - Modern Minimalist Edition
 *  December 2024
 *  ================================================================ */

/* ============================================================
 *  DESIGN TOKENS & VARIABLES
 *  ============================================================ */

:root {
    /* Primary Color Palette */
    --sage-green: #7a8471;
    --dark-sage: #6a7461;
    --khaki-brown: #8b7355;
    --light-khaki: #a68968;
    --cream: #f5f3f0;
    --dark-brown: #4a3c2a;

    /* Neutral Palette */
    --white: #ffffff;
    --gray-50: #fafbfc;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;

    /* Semantic Colors */
    --success: #28a745;
    --success-light: #d4edda;
    --danger: #dc3545;
    --danger-light: #f8d7da;
    --warning: #ffc107;
    --warning-light: #fff3cd;
    --info: #17a2b8;
    --info-light: #d1ecf1;

    /* Sidebar Colors */
    --sidebar-bg: #3d4d5c;
    --sidebar-header: #34424f;
    --sidebar-text: rgba(255, 255, 255, 0.8);
    --sidebar-hover: rgba(255, 255, 255, 0.1);
    --sidebar-active: rgba(122, 132, 113, 0.3);

    /* Shadows - Flatter, more subtle */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.10);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 8px 24px rgba(0, 0, 0, 0.15);

    /* Border Radius - Reduced for flatter design */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 10px;
    --radius-pill: 20px;
    --radius-full: 9999px;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 20px;
    --space-xl: 24px;
    --space-2xl: 32px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* Typography */
    --font-size-xs: 11px;
    --font-size-sm: 12px;
    --font-size-base: 13px;
    --font-size-md: 14px;
    --font-size-lg: 16px;
    --font-size-xl: 18px;
    --font-size-2xl: 24px;
    --font-size-3xl: 32px;

    /* Z-Index */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal: 10000;
}

/* ============================================================
 *  BASE STYLES
 *  ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', sans-serif;
    background: var(--gray-100);
    min-height: 100vh;
    line-height: 1.5;
    color: var(--gray-800);
    font-size: var(--font-size-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
 *  LAYOUT
 *  ============================================================ */

.app-container {
    display: flex;
    min-height: 100vh;
}

/* ============================================================
 *  SIDEBAR - MODERN DARK DESIGN
 *  ============================================================ */

.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.08);
    z-index: var(--z-fixed);
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sidebar-header {
    padding: 24px 20px;
    background: var(--sidebar-header);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 22px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
    overflow: hidden;
    border: none;
}

.brand-icon img {
    width: 85%;
    height: 85%;
    object-fit: contain;
}

.brand-text h1 {
    font-size: 17px;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.3px;
    margin: 0;
}

.brand-text p {
    font-size: var(--font-size-xs);
    color: rgba(255, 255, 255, 0.6);
    margin: 3px 0 0 0;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    position: absolute;
    top: 24px;
    right: -12px;
    width: 24px;
    height: 24px;
    background: #7a8471;
    border: 2px solid #3d4d5c;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 10;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-toggle:hover {
    background: #6a7461;
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.sidebar-toggle:active {
    transform: scale(1.05);
}

.sidebar-toggle svg {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

/* Collapse animations for text elements */
.brand-text,
.menu-item span:not(.menu-icon),
.user-details {
    display: block;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .menu-item span:not(.menu-icon),
.sidebar.collapsed .user-details {
    opacity: 0;
    max-width: 0;
    transition: opacity 0.15s ease, max-width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar:not(.collapsed) .brand-text,
.sidebar:not(.collapsed) .menu-item span:not(.menu-icon),
.sidebar:not(.collapsed) .user-details {
    opacity: 1;
    max-width: 200px;
    transition: max-width 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease 0.15s;
}

/* Section titles */
.sidebar.collapsed .menu-section-title {
    opacity: 0;
    max-height: 0;
    margin: 0;
    transition: opacity 0.15s ease, max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), margin 0.35s ease;
}

.sidebar:not(.collapsed) .menu-section-title {
    opacity: 1;
    max-height: 30px;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease 0.15s;
}

/* Layout transitions */
.sidebar.collapsed .brand-logo {
    justify-content: center;
    transition: justify-content 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand-logo {
    transition: justify-content 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Perfect icon centering in collapsed mode */
.sidebar.collapsed .menu-item {
    justify-content: center;
    padding: 12px 0;
    gap: 0;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed .menu-section {
    padding: 12px 0;
    transition: padding 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar:not(.collapsed) .menu-section {
    padding: 16px 12px;
    transition: padding 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed .user-info {
    justify-content: center;
    padding: 16px 0;
    gap: 0;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Active indicator for collapsed state */
.sidebar.collapsed .menu-item.active::before {
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 3px;
    top: auto;
    bottom: 4px;
    border-radius: 50%;
}

/* Menu icon - no movement */
.menu-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    flex-shrink: 0;
}

/* Menu Sections */
.menu-section {
    padding: var(--space-md) 12px;
}

.menu-section-title {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 12px;
    margin-bottom: 10px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin: 2px 0;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--sidebar-text);
    font-size: var(--font-size-md);
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
}

.menu-item:hover {
    background: var(--sidebar-hover);
    color: var(--white);
}

.menu-item.active {
    background: var(--sidebar-active);
    color: var(--white);
    position: relative;
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #7a8471;
    border-radius: 0 2px 2px 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* User Info */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: var(--sidebar-header);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7a8471 0%, #8e9986 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    font-size: var(--font-size-md);
    color: var(--white);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: var(--font-size-sm);
    color: rgba(255, 255, 255, 0.6);
}

/* ============================================================
 *  MAIN CONTENT
 *  ============================================================ */

.main-content {
    margin-left: 280px;
    flex: 1;
    background: var(--gray-100);
    min-height: 100vh;
    width: calc(100% - 280px);
    transition: margin-left 0.35s cubic-bezier(0.4, 0, 0.2, 1), width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed ~ .main-content {
    margin-left: 70px;
    width: calc(100% - 70px);
}

.top-bar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 20px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-md);
    box-shadow: var(--shadow-xs);
}

.page-title {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: var(--gray-900);
    letter-spacing: -0.5px;
    margin: 0;
}

.page-subtitle,
.page-breadcrumb {
    font-size: var(--font-size-sm);
    color: var(--gray-600);
    margin-top: 4px;
}

.top-bar-actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.content {
    padding: var(--space-xl);
    max-width: 1600px;
    margin: 0 auto;
}

/* ============================================================
 *  CARDS - FLATTER DESIGN
 *  ============================================================ */

.card {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    margin-bottom: var(--space-lg);
    transition: box-shadow var(--transition-base);
}

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--gray-100);
    background: var(--gray-50);
}

.card-header h2 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.card-refresh {
    background: none;
    border: none;
    color: var(--gray-600);
    cursor: pointer;
    font-size: var(--font-size-lg);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.card-refresh:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

.card-body {
    padding: var(--space-lg);
}

.card-subtitle {
    font-size: var(--font-size-sm);
    color: var(--gray-600);
    margin-top: 4px;
}

/* ============================================================
 *  STAT CARDS
 *  ============================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--white);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    border-left: 4px solid var(--sage-green);
    transition: all var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card.success {
    border-left-color: var(--success);
}

.stat-card.warning {
    border-left-color: var(--warning);
}

.stat-card.danger {
    border-left-color: var(--danger);
}

.stat-card.info {
    border-left-color: var(--info);
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-sm);
    font-weight: 600;
}

.stat-value {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-xs);
    line-height: 1;
    letter-spacing: -1px;
}

.stat-change {
    font-size: var(--font-size-sm);
    color: var(--gray-600);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

/* ============================================================
 *  BUTTONS - FLATTER DESIGN
 *  ============================================================ */

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-md);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    text-decoration: none;
    line-height: 1.5;
}

.btn-sm {
    padding: 6px 12px;
    font-size: var(--font-size-sm);
}

.btn-lg {
    padding: 12px 24px;
    font-size: var(--font-size-lg);
}

.btn-primary {
    background: var(--sage-green);
    color: var(--white);
    box-shadow: var(--shadow-xs);
}

.btn-primary:hover {
    background: var(--dark-sage);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.btn-success {
    background: var(--success);
    color: var(--white);
    box-shadow: var(--shadow-xs);
}

.btn-success:hover {
    background: #218838;
    box-shadow: var(--shadow-sm);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
    box-shadow: var(--shadow-xs);
}

.btn-danger:hover {
    background: #c82333;
    box-shadow: var(--shadow-sm);
}

/* Pill Buttons */
.pill-btn {
    display: inline-block;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: var(--font-size-sm);
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pill-btn-primary {
    background: var(--sage-green);
    color: white;
}

.pill-btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.pill-btn-success {
    background: var(--success);
    color: white;
}

.pill-btn-danger {
    background: var(--danger);
    color: white;
}

.pill-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-sm);
}

/* ============================================================
 *  FORMS
 *  ============================================================ */

.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-xs);
    color: var(--gray-800);
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-md);
    transition: all var(--transition-fast);
    background: var(--white);
    font-family: inherit;
    color: var(--gray-800);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--sage-green);
    box-shadow: 0 0 0 3px rgba(122, 132, 113, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

/* ============================================================
 *  TABLES
 *  ============================================================ */

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-base);
}

thead {
    background: var(--gray-100);
}

th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 700;
    color: var(--gray-700);
    text-transform: uppercase;
    font-size: var(--font-size-xs);
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-300);
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

tbody tr {
    transition: background var(--transition-fast);
}

tbody tr:hover {
    background: var(--gray-50);
}

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

/* ============================================================
 *  BADGES
 *  ============================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: var(--success-light);
    color: #155724;
}

.badge-warning {
    background: var(--warning-light);
    color: #856404;
}

.badge-danger {
    background: var(--danger-light);
    color: #721c24;
}

.badge-info {
    background: var(--info-light);
    color: #0c5460;
}

/* ============================================================
 *  ALERTS
 *  ============================================================ */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    font-size: var(--font-size-md);
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    border-left: 4px solid;
}

.alert-danger {
    background: var(--danger-light);
    color: #721c24;
    border-left-color: var(--danger);
}

.alert-success {
    background: var(--success-light);
    color: #155724;
    border-left-color: var(--success);
}

.alert-info {
    background: var(--info-light);
    color: #0c5460;
    border-left-color: var(--info);
}

.alert-warning {
    background: var(--warning-light);
    color: #856404;
    border-left-color: var(--warning);
}

/* ============================================================
 *  FILTERS
 *  ============================================================ */

.filter-bar {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-xs);
}

.filter-title {
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.filter-controls {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-base);
    background: white;
    color: var(--gray-700);
}

.filter-select:focus {
    border-color: var(--sage-green);
    outline: none;
    box-shadow: 0 0 0 3px rgba(122, 132, 113, 0.1);
}

/* ============================================================
 *  SUMMARY BOXES
 *  ============================================================ */

.summary-box {
    text-align: center;
    padding: var(--space-lg);
    background: var(--gray-100);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
}

.summary-icon {
    font-size: 28px;
    margin-bottom: var(--space-sm);
}

.summary-value {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.summary-label {
    font-size: var(--font-size-sm);
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================================
 *  CHARTS
 *  ============================================================ */

.chart-container {
    position: relative;
    height: 320px;
    margin-top: var(--space-md);
}

/* ============================================================
 *  ACTIVITY FEED
 *  ============================================================ */

.activity-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item-content h4 {
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--gray-900);
    margin: 0 0 4px 0;
}

.activity-item-content p {
    font-size: var(--font-size-base);
    color: var(--gray-600);
    margin: 0;
}

.activity-item-time {
    font-size: var(--font-size-sm);
    color: var(--gray-500);
    white-space: nowrap;
    margin-left: var(--space-md);
}

/* ============================================================
 *  TOAST NOTIFICATIONS
 *  ============================================================ */

.toast-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: var(--z-modal);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-width: 400px;
}

.toast {
    background: var(--white);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    border-left: 4px solid;
    animation: toastIn 0.3s ease-out;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.info {
    border-left-color: var(--info);
}

.toast.warning {
    border-left-color: var(--warning);
}

/* ============================================================
 *  MOBILE MENU
 *  ============================================================ */

.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: var(--space-lg);
    left: var(--space-lg);
    z-index: calc(var(--z-fixed) + 1);
    background: var(--sage-green);
    color: var(--white);
    border: none;
    padding: 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 18px;
    box-shadow: var(--shadow-md);
}

/* ============================================================
 *  EMPTY STATES
 *  ============================================================ */

.empty-state {
    text-align: center;
    padding: 60px var(--space-lg);
    color: var(--gray-600);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: var(--space-lg);
    opacity: 0.3;
}

.empty-state-text {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-sm);
    font-weight: 600;
    color: var(--gray-700);
}

.empty-state-subtext {
    font-size: var(--font-size-md);
    margin-bottom: var(--space-xl);
    color: var(--gray-600);
}

/* ============================================================
 *  RESPONSIVE
 *  ============================================================ */

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

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

    .form-row {
        grid-template-columns: 1fr;
    }

    .top-bar {
        padding: var(--space-md);
    }

    .top-bar-actions {
        width: 100%;
    }

    .top-bar-actions .btn {
        flex: 1;
    }

    .content {
        padding: var(--space-md);
    }
}

/* ============================================================
 *  UTILITY CLASSES
 *  ============================================================ */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }

.w-full { width: 100%; }
.hidden { display: none; }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-lg { font-size: var(--font-size-lg); }

/* ============================================================
 *  LOGIN PAGE STYLES - MODERN MINIMALIST
 *  ============================================================ */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--cream) 100%);
    padding: var(--space-xl);
}

.login-box {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    width: 100%;
    max-width: 440px;
    padding: var(--space-2xl);
}

.login-header {
    text-align: center;
    margin-bottom: var(--space-2xl);
    padding-bottom: var(--space-lg);
    border-bottom: 2px solid var(--gray-100);
}

.login-logo {
    margin-bottom: var(--space-lg);
    display: flex;
    justify-content: center;
}

.login-logo img {
    height: 80px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.login-header h1 {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 var(--space-xs) 0;
    letter-spacing: -0.5px;
}

.login-header .gradient-primary {
    background: linear-gradient(135deg, var(--sage-green) 0%, var(--khaki-brown) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-header p {
    font-size: var(--font-size-md);
    color: var(--gray-600);
    margin: 0;
    font-weight: 500;
}

.btn-login {
    width: 100%;
    padding: 12px 24px;
    background: var(--sage-green);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-md);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-xs);
    margin-top: var(--space-md);
}

.btn-login:hover {
    background: var(--dark-sage);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

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

.btn-login.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-login.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.forgot-password-link {
    text-align: right;
    margin-top: calc(-1 * var(--space-xs));
    margin-bottom: var(--space-lg);
}

.forgot-password-link a {
    color: var(--gray-600);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: 600;
    transition: all var(--transition-base);
    position: relative;
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
}

.forgot-password-link a:hover {
    color: var(--sage-green);
    background: rgba(122, 132, 113, 0.05);
}

.register-section {
    margin-top: var(--space-xl);
    text-align: center;
    padding: var(--space-lg);
    background: var(--gray-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    transition: all var(--transition-base);
}

.register-section:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
    box-shadow: var(--shadow-xs);
}

.register-section p {
    color: var(--gray-700);
    font-size: var(--font-size-md);
    margin: 0;
    font-weight: 500;
}

.register-section a {
    color: var(--sage-green);
    text-decoration: none;
    font-weight: 700;
    margin-left: var(--space-xs);
    transition: all var(--transition-base);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    display: inline-block;
}

.register-section a:hover {
    color: var(--dark-sage);
    background: rgba(122, 132, 113, 0.1);
}

/* Login Page Alerts */
.login-box .alert {
    margin-bottom: var(--space-lg);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
}

/* Responsive */
@media (max-width: 480px) {
    .login-container {
        padding: var(--space-md);
    }
    
    .login-box {
        padding: var(--space-lg);
    }
    
    .login-header h1 {
        font-size: var(--font-size-2xl);
    }
}

/* ============================================================
 *  FINANCIAL MODULE - RECEIPT CARD STYLES
 *  ============================================================ */

/* Receipt Card Grid */
.receipt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-lg);
}

/* Receipt Card */
.receipt-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.receipt-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.receipt-card.paid {
    border-left: 4px solid var(--success);
}

.receipt-card.unpaid {
    border-left: 4px solid var(--danger);
}

.receipt-card.partial {
    border-left: 4px solid var(--warning);
}

/* Receipt Header */
.receipt-header {
    background: var(--khaki-brown);
    color: var(--white);
    padding: var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.receipt-number {
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.receipt-status {
    font-size: var(--font-size-xs);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

/* Receipt Body */
.receipt-body {
    padding: var(--space-md);
}

.receipt-vendor {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.receipt-date {
    font-size: var(--font-size-sm);
    color: var(--gray-600);
    margin-bottom: var(--space-md);
}

.receipt-details {
    font-size: var(--font-size-sm);
    color: var(--gray-700);
    line-height: 1.6;
    margin-bottom: var(--space-md);
}

.receipt-divider {
    border: none;
    border-top: 1px dashed var(--gray-300);
    margin: var(--space-md) 0;
}

/* Receipt Amount Section */
.receipt-amount {
    text-align: right;
}

.receipt-amount-label {
    font-size: var(--font-size-xs);
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.receipt-amount-value {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--khaki-brown);
    line-height: 1;
}

.receipt-amount-breakdown {
    font-size: var(--font-size-xs);
    color: var(--gray-500);
    margin-top: 4px;
}

/* Receipt Actions */
.receipt-actions {
    padding: var(--space-sm) var(--space-md);
    background: var(--gray-50);
    display: flex;
    gap: var(--space-sm);
    border-top: 1px solid var(--gray-200);
}

.receipt-actions .btn {
    flex: 1;
    font-size: var(--font-size-sm);
    padding: 6px 12px;
}

/* Cost Category Badge */
.cost-category-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: var(--font-size-xs);
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.cost-category-badge.transport_in {
    background: #e3f2fd;
    color: #1565c0;
}

.cost-category-badge.commission {
    background: #fff3e0;
    color: #e65100;
}

.cost-category-badge.levies {
    background: #f3e5f5;
    color: #6a1b9a;
}

.cost-category-badge.labour {
    background: #e8f5e9;
    color: #2e7d32;
}

.cost-category-badge.yard {
    background: #fbe9e7;
    color: #bf360c;
}

.cost-category-badge.interest {
    background: #fce4ec;
    color: #c2185b;
}

.cost-category-badge.other {
    background: var(--gray-200);
    color: var(--gray-700);
}

/* Financial Summary Boxes */
.financial-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.financial-summary-box {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    text-align: center;
}

.financial-summary-box.positive {
    border-left: 4px solid var(--success);
}

.financial-summary-box.negative {
    border-left: 4px solid var(--danger);
}

.financial-summary-box.neutral {
    border-left: 4px solid var(--khaki-brown);
}

.financial-summary-label {
    font-size: var(--font-size-xs);
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-sm);
}

.financial-summary-value {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.financial-summary-subtext {
    font-size: var(--font-size-sm);
    color: var(--gray-500);
}

/* P&L Layout */
.pl-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
    margin-top: var(--space-xl);
}

.pl-section {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
}

.pl-section-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--gray-200);
}

.pl-line-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--gray-100);
}

.pl-line-item:last-child {
    border-bottom: none;
}

.pl-line-label {
    font-size: var(--font-size-base);
    color: var(--gray-700);
}

.pl-line-value {
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--gray-900);
}

.pl-line-item.sub-item {
    padding-left: var(--space-lg);
    font-size: var(--font-size-sm);
}

.pl-line-item.sub-item .pl-line-label {
    color: var(--gray-600);
}

.pl-line-item.total {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 2px solid var(--gray-300);
    font-weight: 700;
}

.pl-line-item.total .pl-line-label {
    font-size: var(--font-size-lg);
    color: var(--gray-900);
}

.pl-line-item.total .pl-line-value {
    font-size: var(--font-size-xl);
    color: var(--khaki-brown);
}

.pl-line-item.profit {
    background: var(--success-light);
    padding: var(--space-md);
    border-radius: var(--radius-sm);
    margin-top: var(--space-md);
}

.pl-line-item.profit .pl-line-value {
    color: var(--success);
    font-size: var(--font-size-2xl);
}

/* Invoice Template Styles */
.invoice-template {
    background: var(--white);
    max-width: 800px;
    margin: 0 auto;
    padding: var(--space-2xl);
    border: 1px solid var(--gray-200);
}

.invoice-header-section {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: var(--space-2xl);
    padding-bottom: var(--space-lg);
    border-bottom: 2px solid var(--khaki-brown);
}

.invoice-company-info h1 {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--space-sm);
}

.invoice-details {
    text-align: right;
}

.invoice-number-display {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--khaki-brown);
    margin-bottom: var(--space-xs);
}

.invoice-bill-to {
    margin-bottom: var(--space-2xl);
}

.invoice-bill-to h3 {
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    color: var(--gray-600);
    margin-bottom: var(--space-sm);
}

.invoice-table {
    width: 100%;
    margin-bottom: var(--space-2xl);
}

.invoice-table th {
    background: var(--gray-100);
    padding: var(--space-md);
    text-align: left;
}

.invoice-table td {
    padding: var(--space-md);
    border-bottom: 1px solid var(--gray-200);
}

.invoice-total-section {
    text-align: right;
    margin-top: var(--space-xl);
}

.invoice-total-line {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2xl);
    padding: var(--space-sm) 0;
}

.invoice-total-line.grand-total {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--khaki-brown);
    border-top: 2px solid var(--gray-300);
    padding-top: var(--space-md);
    margin-top: var(--space-sm);
}

/* Performance Rating Colors */
.performance-excellent {
    color: var(--success);
    font-weight: 700;
}

.performance-good {
    color: #2e7d32;
    font-weight: 600;
}

.performance-fair {
    color: var(--warning);
    font-weight: 600;
}

.performance-poor {
    color: var(--danger);
    font-weight: 700;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .receipt-grid {
        grid-template-columns: 1fr;
    }
    
    .pl-layout {
        grid-template-columns: 1fr;
    }
    
    .financial-summary-grid {
        grid-template-columns: 1fr;
    }
}

/* loading animation */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
}

.loading-content-minimal {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--sage-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    color: white;
    animation: scaleIn 0.3s ease;
}

.success-icon {
    background: var(--success);
    border: 4px solid rgba(40, 167, 69, 0.3);
}

.error-icon {
    background: var(--danger);
    border: 4px solid rgba(220, 53, 69, 0.3);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.loading-message {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: white;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}