/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    transition: width 0.3s ease;
    z-index: 1000;
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.toggle-btn, .close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.toggle-btn:hover, .close-btn:hover {
    background-color: rgba(255,255,255,0.1);
}

.menu {
    list-style: none;
}

.menu-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
}

.menu-item:hover {
    background-color: rgba(255,255,255,0.1);
    border-left-color: #fff;
}

.menu-item.active {
    background-color: rgba(255,255,255,0.15);
    border-left-color: #fff;
}

.menu-item .icon {
    margin-right: 12px;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.menu-item span {
    font-weight: 500;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 250px;
    transition: margin-left 0.3s ease;
}

.app-container.sidebar-collapsed .main-content {
    margin-left: 70px;
}

/* Header */
.header {
    background: white;
    padding: 15px 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.sidebar-toggle-mobile {
    display: none;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    color: #666;
    transition: background-color 0.2s;
}

.sidebar-toggle-mobile:hover {
    background-color: #f0f0f0;
}

.search-bar {
    flex: 1;
    max-width: 400px;
    margin: 0 30px;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.search-bar input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.notification-btn, .profile-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.notification-btn:hover, .profile-btn:hover {
    background-color: #f0f0f0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.user-details {
    text-align: left;
}

.user-details .name {
    font-weight: 600;
    font-size: 14px;
}

.user-details .role {
    font-size: 12px;
    color: #666;
}

/* Content Area */
.content-area {
    padding: 30px;
    max-width: 100%;
}

h1 {
    margin-bottom: 30px;
    color: #333;
    font-size: 2rem;
    font-weight: 600;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.card-icon {
    font-size: 1.5rem;
    color: #667eea;
}

.card-value {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 5px;
}

.card-change {
    font-size: 0.9rem;
    font-weight: 500;
}

.card-change.positive {
    color: #28a745;
}

.card-change.negative {
    color: #dc3545;
}

/* Charts Section */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.chart-container h3 {
    margin-bottom: 20px;
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

/* Table Styles */
.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.table-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.actions {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #e9ecef;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 20px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tbody tr {
    transition: background-color 0.2s ease;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

.action-buttons {
    display: flex;
    gap: 5px;
}

.edit-btn {
    background: #ffc107;
    color: white;
}

.edit-btn:hover {
    background: #e0a800;
}

.delete-btn {
    background: #dc3545;
    color: white;
}

.delete-btn:hover {
    background: #c82333;
}

.view-btn {
    background: #17a2b8;
    color: white;
}

.view-btn:hover {
    background: #138496;
}

.adjust-btn {
    background: #6f42c1;
    color: white;
}

.adjust-btn:hover {
    background: #5a359a;
}

.duplicate-btn {
    background: #20c997;
    color: white;
}

.duplicate-btn:hover {
    background: #1aa085;
}

/* Form Styles */
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-group {
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 0;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-header {
    padding: 30px 30px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.modal-body {
    padding: 20px 30px;
}

/* Loading and Status Styles */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    margin: 20px 0;
}

.error-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

/* Status Colors */
.status-active, .status-completed {
    color: #28a745;
    font-weight: 600;
}

.status-inactive, .status-pending {
    color: #ffc107;
    font-weight: 600;
}

.status-discontinued, .status-failed {
    color: #dc3545;
    font-weight: 600;
}

.status-draft {
    color: #6c757d;
    font-weight: 600;
}

.amount-positive {
    color: #28a745;
    font-weight: 600;
}

.amount-negative {
    color: #dc3545;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 70px;
        position: fixed;
        left: -70px;
        transition: left 0.3s ease;
    }

    .sidebar.show {
        left: 0;
    }

    .sidebar.collapsed {
        width: 70px;
        left: 0;
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle-mobile {
        display: block;
    }

    .sidebar .sidebar-header h2,
    .sidebar .menu-item span {
        display: none;
    }

    .header {
        padding: 15px 20px;
    }

    .search-bar {
        margin: 0 15px;
        max-width: 200px;
    }

    .user-actions .user-details {
        display: none;
    }

    .content-area {
        padding: 20px 15px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .charts-section {
        grid-template-columns: 1fr;
    }

    .table-container .table-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .table-container .actions {
        justify-content: center;
    }

    table {
        font-size: 0.9rem;
    }

    th, td {
        padding: 8px 12px;
    }

    .form-row {
        flex-direction: column;
        gap: 15px;
    }

    .modal-content {
        margin: 20px;
        width: calc(100% - 40px);
    }
}

@media (max-width: 480px) {
    .header .search-bar {
        display: none;
    }

    .header .user-actions {
        gap: 10px;
    }

    .content-area {
        padding: 15px 10px;
    }

    .card {
        padding: 15px;
    }

    .card-value {
        font-size: 1.5rem;
    }

    .chart-container {
        padding: 15px;
    }
}