/**
 * Modern Design System - Rolnik Platform
 * Inspired by modern dashboard designs
 */

/* ===== CSS Variables ===== */
:root {
    /* Primary Colors */
    --primary: #1a472a;
    --primary-light: #2d5a3a;
    --primary-lighter: #3d7a4a;
    --primary-dark: #0f2d1a;

    /* Accent Colors */
    --accent: #4ade80;
    --accent-light: #86efac;
    --accent-dark: #22c55e;

    /* Neutral Colors */
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Status Colors */
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --error: #ef4444;
    --error-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Border Radius */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

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

    /* Font */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--gray-900);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

.text-muted {
    color: var(--gray-500) !important;
}

.text-primary {
    color: var(--primary) !important;
}

.text-success {
    color: var(--success) !important;
}

/* ===== Modern Card ===== */
.modern-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
    overflow: hidden;
    transition: var(--transition);
}

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

.modern-card .card-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
    padding: 1.25rem 1.5rem;
}

.modern-card .card-body {
    padding: 1.5rem;
}

/* ===== Stat Cards ===== */
.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--gray-100);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

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

.stat-card.primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--white);
    border: none;
}

.stat-card.primary .stat-label {
    color: rgba(255, 255, 255, 0.8);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.stat-card .stat-icon.primary {
    background: var(--primary);
    color: var(--white);
}

.stat-card .stat-icon.success {
    background: var(--success-light);
    color: var(--success);
}

.stat-card .stat-icon.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-card .stat-icon.info {
    background: var(--info-light);
    color: var(--info);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    color: var(--gray-500);
    font-weight: 500;
}

.stat-card .stat-change {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.75rem;
}

.stat-card .stat-change.positive {
    color: var(--success);
}

.stat-card .stat-change.negative {
    color: var(--error);
}

/* ===== Modern Sidebar ===== */
.modern-sidebar {
    width: 280px;
    min-height: 100vh;
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
}

.modern-sidebar .sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.modern-sidebar .sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.modern-sidebar .sidebar-logo-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.25rem;
}

.modern-sidebar .sidebar-logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}

.modern-sidebar .sidebar-nav {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.modern-sidebar .nav-section {
    margin-bottom: 1.5rem;
}

.modern-sidebar .nav-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
}

.modern-sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius);
    color: var(--gray-600);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 0.25rem;
}

.modern-sidebar .nav-item:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.modern-sidebar .nav-item.active {
    background: var(--primary);
    color: var(--white);
}

.modern-sidebar .nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.modern-sidebar .nav-item .badge {
    margin-left: auto;
    background: var(--error);
    color: var(--white);
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-full);
}

.modern-sidebar .sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--gray-100);
}

.modern-sidebar .user-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.modern-sidebar .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.modern-sidebar .user-info {
    flex: 1;
    min-width: 0;
}

.modern-sidebar .user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modern-sidebar .user-role {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* ===== Modern Main Content ===== */
.modern-main {
    margin-left: 280px;
    min-height: 100vh;
    background: var(--gray-50);
}

.modern-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.modern-header .search-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--gray-100);
    padding: 0.625rem 1rem;
    border-radius: var(--radius-full);
    width: 300px;
}

.modern-header .search-box input {
    border: none;
    background: none;
    outline: none;
    flex: 1;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.modern-header .search-box input::placeholder {
    color: var(--gray-400);
}

.modern-header .header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.modern-header .header-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: 1px solid var(--gray-200);
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-600);
    cursor: pointer;
    transition: var(--transition);
}

.modern-header .header-btn:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.modern-content {
    padding: 2rem;
}

.page-title {
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--gray-500);
    font-size: 0.9375rem;
    margin-bottom: 2rem;
}

/* ===== Modern Buttons ===== */
.btn-modern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-modern.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-modern.btn-primary:hover {
    background: var(--primary-dark);
}

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

.btn-modern.btn-secondary:hover {
    background: var(--gray-100);
}

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

.btn-modern.btn-success:hover {
    background: #059669;
}

.btn-modern.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-modern.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

/* ===== Modern Forms ===== */
.form-modern .form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    display: block;
}

.form-modern .form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    transition: var(--transition);
    background: var(--white);
}

.form-modern .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 71, 42, 0.1);
}

.form-modern .form-control::placeholder {
    color: var(--gray-400);
}

/* ===== Standalone Form Elements ===== */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    display: block;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-family: var(--font-sans);
    transition: var(--transition);
    background: var(--white);
    color: var(--gray-800);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 71, 42, 0.1);
}

.form-input::placeholder {
    color: var(--gray-400);
}

.form-input:disabled {
    background: var(--gray-100);
    cursor: not-allowed;
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

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

.form-modern .form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

/* ===== Modern Table ===== */
.table-modern {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-modern thead th {
    background: var(--gray-50);
    padding: 0.875rem 1rem;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table-modern tbody td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.9375rem;
}

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

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

/* ===== Modern Badge ===== */
.badge-modern {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
}

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

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

.badge-modern.error {
    background: var(--error-light);
    color: var(--error);
}

.badge-modern.info {
    background: var(--info-light);
    color: var(--info);
}

.badge-modern.primary {
    background: rgba(26, 71, 42, 0.1);
    color: var(--primary);
}

/* ===== Progress Ring ===== */
.progress-ring {
    position: relative;
    width: 160px;
    height: 160px;
}

.progress-ring svg {
    transform: rotate(-90deg);
}

.progress-ring-circle {
    fill: none;
    stroke: var(--gray-200);
    stroke-width: 12;
}

.progress-ring-progress {
    fill: none;
    stroke: var(--primary);
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dashoffset var(--transition-slow);
}

.progress-ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.progress-ring-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
}

.progress-ring-label {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* ===== Modern Alert ===== */
.alert-modern {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-modern.success {
    background: var(--success-light);
    color: #065f46;
}

.alert-modern.error {
    background: var(--error-light);
    color: #991b1b;
}

.alert-modern.warning {
    background: var(--warning-light);
    color: #92400e;
}

.alert-modern.info {
    background: var(--info-light);
    color: #1e40af;
}

/* ===== Item List ===== */
.item-list {
    display: flex;
    flex-direction: column;
}

.item-list .list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
    transition: var(--transition);
}

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

.item-list .list-item:hover {
    background: var(--gray-50);
}

.item-list .item-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.item-list .item-content {
    flex: 1;
    min-width: 0;
}

.item-list .item-title {
    font-weight: 500;
    color: var(--gray-900);
    margin-bottom: 0.125rem;
}

.item-list .item-subtitle {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.item-list .item-action {
    flex-shrink: 0;
}

/* ===== Team Avatar ===== */
.team-avatars {
    display: flex;
    align-items: center;
}

.team-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    border: 2px solid var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--white);
    margin-left: -8px;
}

.team-avatar:first-child {
    margin-left: 0;
}

.team-avatar.more {
    background: var(--gray-200);
    color: var(--gray-600);
}

/* ===== Grid Layout ===== */
.grid-cols-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.grid-cols-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.grid-cols-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

@media (max-width: 1200px) {
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }

    .modern-sidebar {
        transform: translateX(-100%);
        transition: var(--transition);
        width: 280px;
        z-index: 1000;
    }

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

    .modern-main {
        margin-left: 0;
    }

    .modern-header {
        padding: 1rem;
        flex-wrap: wrap;
        gap: 1rem;
    }

    .modern-header h1 {
        font-size: 1.125rem !important;
    }

    .modern-content {
        padding: 1rem;
    }

    /* Mobile sidebar toggle */
    .mobile-sidebar-toggle {
        display: flex;
        width: 40px;
        height: 40px;
        border-radius: var(--radius);
        border: 1px solid var(--gray-200);
        background: var(--white);
        align-items: center;
        justify-content: center;
        color: var(--gray-600);
        cursor: pointer;
        font-size: 1.25rem;
    }

    .mobile-sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }

    .mobile-sidebar-overlay.active {
        display: block;
    }

    /* Stat cards mobile */
    .stat-card .stat-value {
        font-size: 1.5rem;
    }

    /* Table responsive */
    .table-modern {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    /* Buttons mobile */
    .btn-modern.btn-lg {
        padding: 0.75rem 1.25rem;
        font-size: 0.9375rem;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Hide mobile toggle on desktop */
@media (min-width: 769px) {
    .mobile-sidebar-toggle {
        display: none !important;
    }
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn var(--transition-slow) ease forwards;
}

/* ===== Utility Classes ===== */
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 2rem !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 2rem !important; }

.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }

.flex { display: flex !important; }
.flex-col { flex-direction: column !important; }
.items-center { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.justify-center { justify-content: center !important; }

.w-full { width: 100% !important; }
.h-full { height: 100% !important; }

.rounded { border-radius: var(--radius) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-full { border-radius: var(--radius-full) !important; }

.shadow { box-shadow: var(--shadow) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

.bg-white { background: var(--white) !important; }
.bg-gray-50 { background: var(--gray-50) !important; }
.bg-primary { background: var(--primary) !important; }

/* ===== Responsive Grid Utilities ===== */
.responsive-grid-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.responsive-grid-1-1 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.responsive-grid-1-2 {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
}

@media (max-width: 992px) {
    .responsive-grid-2-1,
    .responsive-grid-1-1,
    .responsive-grid-1-2 {
        grid-template-columns: 1fr;
    }
}
