/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-main: #fbfaf8; /* Warm off-white, matching the burlap organic vibe */
    --bg-card: #ffffff; /* Pure white card background */
    --bg-card-hover: #faf6f0; /* Soft golden-sand white on hover */
    --border-glow: rgba(137, 87, 55, 0.25); /* Warm cocoa glow */
    --border-color: rgba(137, 87, 55, 0.12); /* Sandy brown divider lines */
    --text-primary: #3c2f2f; /* Deep dark cocoa/burlap charcoal for readability */
    --text-secondary: #6e5e53; /* Medium warm earthy brown */
    --text-muted: #9e8b7c; /* Soft sandy gray-brown */
    --color-accent: #895737; /* Burlap cocoa/jute brown accent */
    --color-accent-gradient: linear-gradient(135deg, #895737 0%, #b07d62 100%); /* Earthy chocolate gradient */
    --color-success: #15803d; /* Forest green */
    --color-danger: #b91c1c; /* Crimson red */
    --color-warning: #b45309; /* Warm amber gold */
    --font-sans: 'Outfit', sans-serif;
    --sidebar-width: 280px;
    --header-height: 70px;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-sans);
}

body {
    background: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-accent);
}

/* Main Layout Grid */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar Styling - Burlap Paper texture style */
.sidebar {
    width: var(--sidebar-width);
    background: #efe3d6; /* Rich warm paper/jute color */
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    z-index: 100;
    transition: var(--transition-smooth);
}

.sidebar-brand {
    padding: 1.8rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-bottom: 1px solid var(--border-color);
}

.brand-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: var(--color-accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: white;
    font-size: 1.2rem;
    box-shadow: 0 4px 10px rgba(137, 87, 55, 0.2);
}

.brand-name {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #3c2f2f 0%, #895737 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-menu {
    list-style: none;
    padding: 1.5rem 1rem;
    flex-grow: 1;
    overflow-y: auto;
}

.menu-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 1.2px;
    margin: 1.2rem 0 0.5rem 0.8rem;
}

.menu-item {
    margin-bottom: 0.4rem;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: var(--transition-smooth);
}

.menu-link:hover {
    color: var(--text-primary);
    background: rgba(137, 87, 55, 0.06);
    padding-left: 1.2rem;
}

.menu-item.active .menu-link {
    color: white;
    background: var(--color-accent-gradient);
    box-shadow: 0 4px 15px rgba(137, 87, 55, 0.25);
    font-weight: 600;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(137, 87, 55, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--color-accent);
}

.user-info {
    font-size: 0.85rem;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-logout {
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.btn-logout:hover {
    color: var(--color-danger);
    transform: scale(1.1);
}

/* Main Content Area */
.main-wrapper {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition-smooth);
}

/* Topbar Header */
.top-header {
    height: var(--header-height);
    background: rgba(251, 250, 248, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

.header-title-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

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

.current-date-badge {
    background: rgba(137, 87, 55, 0.06);
    border: 1px solid var(--border-color);
    padding: 0.45rem 1rem;
    border-radius: var(--radius-lg);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Content Container */
.content-body {
    padding: 2rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Cards Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.dashboard-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(137, 87, 55, 0.05);
}

.dashboard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--color-accent-gradient);
    opacity: 0;
    transition: var(--transition-smooth);
}

.dashboard-card:hover {
    transform: translateY(-4px);
    background: var(--bg-card-hover);
    border-color: var(--border-glow);
    box-shadow: 0 10px 25px rgba(137, 87, 55, 0.1);
}

.dashboard-card:hover::before {
    opacity: 1;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 0.9rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.8px;
}

.card-icon-wrapper {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.icon-purchase { background: rgba(137, 87, 55, 0.12); color: var(--color-accent); }
.icon-sales { background: rgba(21, 128, 61, 0.1); color: var(--color-success); }
.icon-stock { background: rgba(180, 83, 9, 0.1); color: var(--color-warning); }

.card-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.card-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Two Column Layout */
.layout-split {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .layout-split {
        grid-template-columns: 2fr 1fr;
    }
    .layout-split.equal {
        grid-template-columns: 1fr 1fr;
    }
}

/* Glass Panels */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 15px rgba(137, 87, 55, 0.04);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.panel-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Modern Form Elements */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.8rem 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
    width: 100%;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-accent);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(137, 87, 55, 0.15);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236e5e53'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2rem;
    padding-right: 2.5rem;
}

/* Custom modern check/radio inputs */
.form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* Modern Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: var(--transition-smooth);
}

.btn-primary {
    background: var(--color-accent-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(137, 87, 55, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(137, 87, 55, 0.35);
}

.btn-secondary {
    background: rgba(137, 87, 55, 0.06);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(137, 87, 55, 0.12);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--color-danger);
    color: white;
    box-shadow: 0 4px 12px rgba(185, 28, 28, 0.2);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(185, 28, 28, 0.35);
}

/* Data Table Styling */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

.data-table th {
    background: #efe3d6; /* Organic warm paper color */
    color: var(--text-primary);
    font-weight: 600;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    transition: var(--transition-smooth);
}

.data-table tbody tr {
    transition: var(--transition-smooth);
}

.data-table tbody tr:hover {
    background: rgba(137, 87, 55, 0.04);
}

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

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-inward {
    background: rgba(21, 128, 61, 0.08);
    color: #15803d;
    border: 1px solid rgba(21, 128, 61, 0.18);
}

.badge-outward {
    background: rgba(185, 28, 28, 0.08);
    color: #b91c1c;
    border: 1px solid rgba(185, 28, 28, 0.18);
}

/* Alert Banners */
.ui-alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 500;
    animation: slideIn 0.3s ease;
}

.ui-alert-success {
    background: rgba(21, 128, 61, 0.08);
    border: 1px solid rgba(21, 128, 61, 0.2);
    color: #15803d;
}

.ui-alert-error {
    background: rgba(185, 28, 28, 0.08);
    border: 1px solid rgba(185, 28, 28, 0.2);
    color: #b91c1c;
}

.ui-alert-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    cursor: pointer;
}

/* Keyframes */
@keyframes slideIn {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
    .sidebar {
        left: calc(-1 * var(--sidebar-width));
    }
    .sidebar.open {
        left: 0;
    }
    .main-wrapper {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: block;
    }
}

/* Ledger Details Formatting */
.ledger-header-info {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(137, 87, 55, 0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.ledger-header-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ledger-header-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.ledger-header-val {
    font-size: 1.2rem;
    font-weight: 700;
}

/* Profit Loss Statement Summary */
.pl-summary-box {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.pl-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.05rem;
    padding: 0.75rem 0;
    border-bottom: 1px dashed var(--border-color);
}

.pl-row.subtotal {
    font-weight: 600;
    border-bottom: 1px solid var(--text-muted);
    color: var(--text-primary);
}

.pl-row.net-profit {
    font-size: 1.35rem;
    font-weight: 800;
    border-bottom: 2px double var(--color-accent);
    padding: 1rem 0;
}

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

/* Action Buttons inside tables */
.btn-table-action {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    margin-right: 0.3rem;
}

/* Authenticated User Login Card */
.login-body {
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 15px 30px rgba(137, 87, 55, 0.1);
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
}

.login-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.login-brand-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    background: var(--color-accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(137, 87, 55, 0.25);
}

.login-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}

.login-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Modal Overlay & Box */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(60, 47, 47, 0.45); /* Sand-charcoal background with transparency */
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.25s ease-out;
}

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 800px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition-smooth);
    line-height: 1;
}

.btn-close:hover {
    color: var(--color-danger);
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideDown {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
