/* /assets/css/style.css */
/* Brandable ERP System Modern Styles */

:root {
    /* Brand Colors - These can be dynamically overridden via PHP/Settings */
    --primary-color: #5d4037; /* Lighter Brown for better icon contrast */
    --primary-hover: #3e2723;
    --secondary-color: #8d6e63;
    --background-color: #ffffff;
    --surface-color: #fcfaf9;
    --text-primary: #2d1a10;
    --text-secondary: #5d4037;
    --border-color: rgba(62, 39, 35, 0.12);
    
    /* Semantic Colors */
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    
    /* Layout */
    --sidebar-width: 250px;
    --header-height: 64px;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 14px;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* Layout Construction */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--surface-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease;
    padding-top: env(safe-area-inset-top, 0px);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.brand-logo {
    max-height: 40px;
    max-width: 100%;
    object-fit: contain;
}

.brand-name {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-color);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.app-wrapper.sidebar-hidden {
    grid-template-columns: 1fr;
}

.sidebar-hidden .sidebar {
    display: none;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-item i {
    font-size: 1.25rem;
    margin-right: 0.75rem;
}

.nav-item:hover, .nav-item.active {
    background-color: rgba(62, 39, 35, 0.05);
    color: var(--primary-color);
    border-right: 4px solid var(--primary-color);
    font-weight: 700;
}

.nav-item i {
    color: var(--primary-color);
    opacity: 0.7;
    transition: opacity 0.2s;
}

.nav-item:hover i, .nav-item.active i {
    opacity: 1;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0; /* Important for flex child truncation */
}

/* Header Navbar */
.top-navbar {
    height: var(--header-height);
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: env(safe-area-inset-top, 0px) 1.5rem 0;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

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

.navbar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

/* Profile Dropdown Styles */
.profile-dropdown {
    position: relative;
    display: inline-block;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background 0.2s;
}

.profile-trigger:hover {
    background: rgba(0, 0, 0, 0.04);
}

.profile-img-container {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--border-color);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.profile-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

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

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    z-index: 1000;
    padding: 0.5rem 0;
}

.profile-dropdown:hover .dropdown-menu,
.profile-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: background 0.2s;
    text-decoration: none;
}

.dropdown-item:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--primary-color);
}

.dropdown-item i {
    font-size: 1.2rem;
    color: var(--primary-color);
    opacity: 0.8;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

.dropdown-item.text-danger {
    color: var(--danger-color);
}

.dropdown-item.text-danger i {
    color: var(--danger-color);
}

.dropdown-item.text-danger:hover {
    background: #fef2f2;
}

/* Page Content */
.main-content.full-width {
    margin-left: 0;
    width: 100%;
}

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

.page-container {
    padding: 2rem;
    flex: 1;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

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

/* Cards & Panels */
.card {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

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

.card-body {
    padding: 1.5rem;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #fafafa;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    gap: 0.5rem;
}

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

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

.btn-secondary {
    background-color: white;
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--background-color);
}

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

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background-color: #f9fafb;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.table tbody tr:hover {
    background-color: rgba(249, 250, 251, 0.5);
}

/* Badges */
.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
}

.badge-success { background-color: #d1fae5; color: #065f46; }
.badge-warning { background-color: #fef3c7; color: #92400e; }
.badge-danger { background-color: #fee2e2; color: #991b1b; }
.badge-info { background-color: #dbeafe; color: #1e40af; }
.badge-neutral { background-color: #f3f4f6; color: #374151; }

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    border: 1px solid transparent;
}
.alert-error { background-color: #fef2f2; color: #991b1b; border-color: #f87171; }
.alert-success { background-color: #d1fae5; color: #065f46; border-color: #34d399; }

/* Login Page Only */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--background-color);
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: white;
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.login-logo {
    display: block;
    margin: 0 auto 1.5rem auto;
    max-height: 60px;
    max-width: 100%;
}

.login-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* Dashboard Grid (Odoo Style) */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 2rem 1rem;
    text-align: center;
    box-shadow: var(--box-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border-color);
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
}

.app-icon i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.app-icon:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    color: var(--primary-color);
}

.app-icon span {
    font-weight: 500;
    font-size: 0.9rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        padding-top: env(safe-area-inset-top, 0px);
    }
    
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 10px rgba(0,0,0,0.1);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-toggle {
        display: block;
    }
    
    .app-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .hide-mobile {
        display: none !important;
        visibility: hidden;
        width: 0;
        height: 0;
        overflow: hidden;
    }

    .btn-master {
        padding: 0.4rem !important;
        width: 34px;
        height: 34px;
        min-width: 34px;
        justify-content: center;
        border-radius: 50%; /* Circle button on mobile */
    }

    /* Invoicing Responsive Fixes */
    .invoice-footer-actions {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .invoice-summary-box {
        width: 100% !important;
        text-align: left !important;
    }
}
/* Profile Dropdown Styling */
.navbar-user {
    position: relative;
    display: flex;
    align-items: center;
}

.profile-dropdown {
    position: relative;
    cursor: pointer;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    border-radius: 50px;
    transition: background-color 0.2s;
    background: rgba(0,0,0,0.02);
}

.profile-trigger:hover {
    background: rgba(0,0,0,0.05);
}

.profile-img-container {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--surface-color);
    border: 2px solid var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.profile-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.profile-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

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

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 220px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1), 0 5px 10px rgba(0,0,0,0.04);
    border: 1px solid var(--border-color);
    padding: 8px 0;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background-color: #f8fafc;
    color: var(--primary-color);
}

.dropdown-item i {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

.dropdown-item.text-danger:hover {
    background-color: #fef2f2;
}

/* Mobile adjustments for dropdown */
@media (max-width: 768px) {
    .dropdown-menu {
        position: fixed;
        top: 70px;
        right: 15px;
        left: 15px;
        width: auto;
    }
}
