/* Dark Red Light UI Theme - Complete Updated Version */
:root {
    --primary-red: #8B0000;
    --dark-red: #5C0000;
    --light-red: #B22222;
    --bg-dark: #1a1a1a;
    --bg-card: #2d2d2d;
    --bg-light: #3d3d3d;
    --text-light: #ffffff;
    --text-gray: #cccccc;
    --text-dark: #333333;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    --border-red: #8B0000;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    overflow-x: hidden;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, var(--primary-red), var(--dark-red));
    padding: 15px 30px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.logo h1 {
    font-size: 1.5rem;
    color: var(--text-light);
}

.time-system {
    background: rgba(0,0,0,0.3);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 70px;
    left: 0;
    width: 250px;
    height: calc(100% - 70px);
    background: var(--bg-card);
    padding: 20px 0;
    transition: all 0.3s;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    overflow-y: auto;
    z-index: 999;
}

.sidebar ul {
    list-style: none;
}

.sidebar ul li {
    padding: 12px 20px;
    margin: 5px 0;
    transition: all 0.3s;
}

.sidebar ul li a {
    color: var(--text-light);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
}

.sidebar ul li:hover {
    background: var(--primary-red);
    padding-left: 30px;
}

.sidebar ul li.active {
    background: var(--primary-red);
    border-left: 4px solid var(--warning);
}

/* Main Content */
.main-content {
    margin-left: 250px;
    margin-top: 70px;
    padding: 20px;
    transition: all 0.3s;
    min-height: calc(100vh - 70px);
}

/* Card Styles */
.card {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    border: 1px solid var(--border-red);
}

.card-header {
    border-bottom: 2px solid var(--primary-red);
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-light);
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-gray);
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #444;
    background: var(--bg-light);
    color: var(--text-light);
    border-radius: 5px;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 5px rgba(139,0,0,0.5);
}

/* Button Styles */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background: var(--primary-red);
    color: white;
}

.btn-primary:hover {
    background: var(--light-red);
    transform: translateY(-2px);
    box-shadow: 0 2px 10px rgba(139,0,0,0.3);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
}

.btn-warning {
    background: var(--warning);
    color: #000;
}

.btn-warning:hover {
    background: #e0a800;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.85rem;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #444;
}

table th {
    background: var(--primary-red);
    color: white;
    font-weight: 600;
}

table tr:hover {
    background: rgba(139, 0, 0, 0.1);
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-red), var(--dark-red));
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.stat-card h3 {
    font-size: 0.9rem;
    margin-bottom: 10px;
    opacity: 0.9;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: bold;
}

/* Goal Cards */
.goals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.goal-card {
    background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
    border: 2px solid var(--primary-red);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.goal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(139,0,0,0.2), transparent);
    transition: left 0.5s;
}

.goal-card:hover::before {
    left: 100%;
}

.goal-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(139,0,0,0.3);
}

.goal-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.goal-title {
    color: var(--primary-red);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.goal-value {
    font-size: 2rem;
    font-weight: bold;
    color: white;
    margin: 10px 0;
}

.goal-target {
    color: var(--warning);
    font-size: 0.8rem;
    margin-top: 10px;
}

.progress-bar-container {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    height: 8px;
    margin-top: 15px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary-red), #ff4444);
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
    width: 0%;
}

/* Modal/Popup Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    border: 2px solid var(--primary-red);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-red);
}

.close {
    cursor: pointer;
    font-size: 1.5rem;
    transition: all 0.3s;
}

.close:hover {
    color: var(--primary-red);
    transform: scale(1.1);
}

/* Date Filter */
.date-filter {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-section {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid var(--primary-red);
}

.filter-title {
    color: var(--primary-red);
    margin-bottom: 15px;
    font-size: 1rem;
    font-weight: bold;
}

.filter-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    display: block;
    font-size: 0.8rem;
    margin-bottom: 5px;
    color: var(--text-gray);
}

.filter-group input {
    width: 100%;
    padding: 10px;
    background: var(--bg-light);
    border: 1px solid #444;
    color: white;
    border-radius: 8px;
}

/* Alert Messages */
.alert {
    padding: 12px 20px;
    border-radius: 5px;
    margin-bottom: 15px;
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1100;
    animation: slideIn 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.alert-success {
    background: var(--success);
    color: white;
}

.alert-error {
    background: var(--danger);
    color: white;
}

.alert-info {
    background: var(--info);
    color: white;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Commission Entry Styles */
.commission-entry {
    background: rgba(255,255,255,0.05);
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    position: relative;
    border-left: 3px solid var(--primary-red);
}

.commission-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.remove-commission {
    background: var(--danger);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.remove-commission:hover {
    background: #c82333;
    transform: scale(1.05);
}

.btn-add {
    background: var(--success);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
    width: 100%;
    transition: all 0.3s;
}

.btn-add:hover {
    background: #218838;
    transform: translateY(-2px);
}

.commission-summary {
    background: rgba(139,0,0,0.2);
    padding: 10px;
    border-radius: 5px;
    margin-top: 15px;
    text-align: center;
    font-weight: bold;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

/* Chart Styles */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid var(--primary-red);
}

.chart-title {
    color: var(--primary-red);
    margin-bottom: 15px;
    font-size: 1rem;
    text-align: center;
    font-weight: bold;
}

/* Recent Activity */
.recent-activity {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid var(--primary-red);
}

.activity-list {
    list-style: none;
    padding: 0;
}

.activity-item {
    padding: 12px;
    border-bottom: 1px solid #444;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-text {
    color: white;
}

.activity-time {
    font-size: 0.7rem;
    color: var(--primary-red);
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        left: -250px;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
        padding: 10px;
    }
    
    .header {
        padding: 10px 15px;
    }
    
    .logo h1 {
        font-size: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .goals-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .menu-toggle {
        display: block;
        cursor: pointer;
        font-size: 1.5rem;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    .goal-value {
        font-size: 1.5rem;
    }
    
    .filter-controls {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .charts-section {
        grid-template-columns: 1fr;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        font-size: 0.8rem;
    }
    
    table th, table td {
        padding: 8px;
    }
    
    .modal-content {
        width: 95%;
        padding: 15px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    input, select, textarea {
        font-size: 16px !important;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .goal-card {
        padding: 15px;
    }
    
    .stat-value {
        font-size: 1rem;
    }
    
    .time-system {
        font-size: 0.7rem;
        padding: 5px 10px;
    }
}

@media (min-width: 769px) {
    .menu-toggle {
        display: none;
    }
}

/* Touch-friendly for mobile */
@media (hover: none) and (pointer: coarse) {
    button, .btn, .btn-primary, .btn-success, .btn-danger, .btn-warning {
        min-height: 44px;
        min-width: 44px;
    }
    
    .sidebar ul li {
        padding: 12px 15px;
    }
    
    input, select, textarea {
        min-height: 44px;
    }
}

/* Print Styles for PDF */
@media print {
    .sidebar, .header, .menu-toggle, .btn, .filter-section, .action-buttons {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .stat-card, .goal-card {
        border: 1px solid #ddd;
        break-inside: avoid;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-red);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--light-red);
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.p-20 {
    padding: 20px;
}

.w-100 {
    width: 100%;
}

.cursor-pointer {
    cursor: pointer;
}