/* AZOLVE SaaS Platform - Odoo/Zoho Style */
:root {
    /* Primary Colors */
    --primary: #714B67;
    --primary-dark: #5a3a52;
    --primary-light: #8e6c83;
    
    /* Accent Colors */
    --accent: #00A09D;
    --accent-dark: #008a87;
    --accent-light: #33c7c4;
    
    /* Neutral Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f6fa;
    --bg-tertiary: #edf1f5;
    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --text-tertiary: #b2bec3;
    --border-color: #dfe6e9;
    
    /* Status Colors */
    --success: #00b894;
    --warning: #fdcb6e;
    --danger: #d63031;
    --info: #0984e3;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.15);
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ========== APP DRAWER ========== */
.app-drawer {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: var(--primary);
    color: white;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    box-shadow: 4px 0 12px rgba(0,0,0,0.1);
}

.app-drawer.collapsed {
    width: 80px;
}

.app-drawer-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.app-drawer-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-drawer-logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
}

.app-drawer-logo-text {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.app-drawer.collapsed .app-drawer-logo-text {
    display: none;
}

.app-drawer-search {
    padding: 16px 20px;
}

.app-drawer-search input {
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 14px;
    transition: var(--transition);
}

.app-drawer-search input::placeholder {
    color: rgba(255,255,255,0.6);
}

.app-drawer-search input:focus {
    outline: none;
    background: rgba(255,255,255,0.15);
}

.app-drawer.collapsed .app-drawer-search {
    display: none;
}

.app-drawer-section {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.app-drawer-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 12px;
    padding: 0 8px;
}

.app-drawer.collapsed .app-drawer-section-title {
    display: none;
}

.app-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.app-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    color: rgba(255,255,255,0.8);
    transition: var(--transition);
    cursor: pointer;
}

.app-item:hover,
.app-item.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

.app-item-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    font-size: 16px;
    flex-shrink: 0;
}

.app-item-text {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-drawer.collapsed .app-item-text {
    display: none;
}

.app-drawer.collapsed .app-item {
    justify-content: center;
}

.app-drawer-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

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

.user-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: var(--transition);
}

.user-menu-btn:hover {
    background: rgba(255,255,255,0.2);
}

.app-drawer.collapsed .user-info {
    display: none;
}

.app-drawer.collapsed .user-menu-btn {
    display: none;
}

.app-drawer.collapsed .user-profile {
    justify-content: center;
}

/* ========== MAIN CONTENT ========== */
.main-content {
    margin-left: 280px;
    min-height: 100vh;
    transition: var(--transition);
}

.main-content.expanded {
    margin-left: 80px;
}

/* ========== TOP BAR ========== */
.top-bar {
    background: white;
    padding: 16px 32px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.menu-toggle {
    width: 40px;
    height: 40px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.menu-toggle:hover {
    background: var(--border-color);
}

.breadcrumb {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.breadcrumb-item {
    font-size: 14px;
    color: var(--text-secondary);
}

.breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: 600;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.action-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: var(--transition);
}

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

.action-btn .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    background: var(--danger);
    border-radius: 50%;
    font-size: 11px;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== APP CONTENT ========== */
.app-content {
    padding: 32px;
}

.app-view {
    display: none;
}

.app-view.active {
    display: block;
}

/* ========== APP HEADER ========== */
.app-header {
    margin-bottom: 32px;
}

.app-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.app-description {
    font-size: 14px;
    color: var(--text-secondary);
}

.app-actions {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ========== BUTTONS ========== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

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

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

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

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

.btn-danger:hover {
    background: #c0392b;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* ========== STATS GRID ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.primary {
    background: rgba(113, 75, 103, 0.1);
    color: var(--primary);
}

.stat-icon.accent {
    background: rgba(0, 160, 157, 0.1);
    color: var(--accent);
}

.stat-icon.success {
    background: rgba(0, 184, 148, 0.1);
    color: var(--success);
}

.stat-icon.warning {
    background: rgba(253, 203, 110, 0.1);
    color: var(--warning);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-change {
    font-size: 12px;
    margin-top: 4px;
}

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

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

/* ========== CARDS ========== */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 24px;
}

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

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

thead {
    background: var(--bg-tertiary);
}

th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

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

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

tbody tr:hover {
    background: var(--bg-secondary);
}

/* ========== BADGES ========== */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-primary {
    background: rgba(113, 75, 103, 0.1);
    color: var(--primary);
}

.badge-accent {
    background: rgba(0, 160, 157, 0.1);
    color: var(--accent);
}

.badge-success {
    background: rgba(0, 184, 148, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(253, 203, 110, 0.1);
    color: #f39c12;
}

.badge-danger {
    background: rgba(214, 48, 49, 0.1);
    color: var(--danger);
}

/* ========== FORMS ========== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(113, 75, 103, 0.1);
}

.form-control::placeholder {
    color: var(--text-tertiary);
}

select.form-control {
    background: white;
    cursor: pointer;
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* ========== MODAL ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: var(--transition);
}

.modal.active .modal-content {
    transform: translateY(0);
}

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

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ========== TOAST ========== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 3000;
    transform: translateX(400px);
    transition: var(--transition);
}

.toast.show {
    transform: translateX(0);
}

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast.success .toast-icon {
    background: rgba(0, 184, 148, 0.1);
    color: var(--success);
}

.toast.error .toast-icon {
    background: rgba(214, 48, 49, 0.1);
    color: var(--danger);
}

.toast-message {
    font-size: 14px;
    color: var(--text-primary);
}

/* ========== APP STORE ========== */
.app-store-categories {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.category-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: white;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.category-btn:hover,
.category-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.app-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 2px solid transparent;
}

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

.app-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.app-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.app-card-info {
    flex: 1;
}

.app-card-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.app-card-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.app-card-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

.app-card-actions {
    display: flex;
    gap: 8px;
}

.install-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

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

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

.install-btn.uninstall:hover {
    background: #c0392b;
}

/* ========== ACTION BUTTONS ========== */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-icon.edit:hover {
    background: rgba(0, 160, 157, 0.1);
    color: var(--accent);
    border-color: var(--accent);
}

.btn-icon.delete:hover {
    background: rgba(214, 48, 49, 0.1);
    color: var(--danger);
    border-color: var(--danger);
}

/* ========== SEARCH & FILTER ========== */
.search-filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 200px;
}

.search-box input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
}

.filter-select {
    min-width: 150px;
}

.filter-select select {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: white;
}

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: 60px 24px;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--text-tertiary);
}

.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state-description {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
    .app-drawer {
        transform: translateX(-100%);
    }
    
    .app-drawer.mobile-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .apps-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .top-bar {
        padding: 12px 16px;
    }
    
    .app-content {
        padding: 16px;
    }
    
    .app-header {
        margin-bottom: 24px;
    }
    
    .app-title {
        font-size: 24px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .apps-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .search-filter-bar {
        flex-direction: column;
    }
}