/* PigERP Premium Design System */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #1a5c37;
    --primary-light: #2d8a57;
    --secondary: #f4b400;
    --dark: #121212;
    --light: #f8f9fa;
    --grey: #6c757d;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --glass: rgba(255, 255, 255, 0.1);
    --sidebar-width: 260px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: #f0f2f5;
    color: var(--dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 2rem 1.5rem 6rem;
    /* Extra padding at bottom */
    position: fixed;
    height: 100vh;
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--secondary);
    border-radius: 10px;
}

.nav-links {
    list-style: none;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.8rem 1rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 12px;
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(5px);
}

.nav-link i {
    font-size: 1.2rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-width: 0;
    /* Prevents flex items from overflowing */
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background: white;
    padding: 1rem 2rem;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

/* Dashboard Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border-left: 5px solid var(--primary);
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-title {
    color: var(--grey);
    font-size: 0.9rem;
    font-weight: 500;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 5px 0;
}

.stat-footer {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.text-up {
    color: var(--success);
}

.text-down {
    color: var(--danger);
}

/* Forms & Buttons */
.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-light);
    box-shadow: 0 5px 15px rgba(26, 92, 55, 0.3);
}

/* Glassmorphism for specific sections */
.glass-panel {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 2rem;
}

/* Tables */
.table-container {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f8f9fa;
    padding: 1.2rem;
    text-align: left;
    font-weight: 600;
    color: var(--grey);
    border-bottom: 1px solid #eee;
}

td {
    padding: 1.2rem;
    border-bottom: 1px solid #eee;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: #fafafa;
}

/* Login Page Specific */
.login-body {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-card {
    background: white;
    padding: 3rem;
    border-radius: 30px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border-radius: 12px;
    border: 2px solid #eee;
    font-family: inherit;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(26, 92, 55, 0.1);
}

/* Responsiveness */
@media (max-width: 992px) {
    :root {
        --sidebar-width: 0px;
    }

    .sidebar {
        transform: translateX(-260px);
        width: 260px;
        position: fixed;
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }

    .header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
        text-align: center;
    }

    .header-right {
        width: 100%;
        justify-content: center;
    }

    .table-container {
        overflow-x: auto;
    }

    table {
        min-width: 600px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .glass-panel {
        padding: 1.5rem;
    }

    /* Simple toggle for mobile (requires small script in header/footer) */
    .mobile-nav-toggle {
        display: block !important;
        position: fixed;
        top: 15px;
        /* Moved to top */
        left: 15px;
        /* Moved to left */
        width: 45px;
        height: 45px;
        background: white;
        /* White background for contrast */
        color: var(--primary);
        /* Primary green icon */
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        z-index: 2000;
        /* Above everything */
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
        border: 1px solid #ddd;
        cursor: pointer;
    }
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    margin: auto;
    padding: 2.5rem;
    border-radius: 25px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    animation: modalSlide 0.3s ease-out;
}

@keyframes modalSlide {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal {
    color: var(--grey);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.close-modal:hover {
    color: var(--danger);
}

@media (min-width: 993px) {
    .mobile-nav-toggle {
        display: none !important;
    }
}