/* 
 * CRM Dashboard - Sininen & Oranssi Teema
 * Helposti muokattava väriteema
 */

:root {
    /* Päävärit */
    --primary-blue: #1e3a8a;
    --primary-blue-dark: #1e293b;
    --primary-blue-light: #3b82f6;
    --primary-orange: #f97316;
    --primary-orange-dark: #ea580c;
    --primary-orange-light: #fb923c;
    
    /* Taustavärit */
    --bg-main: #f1f5f9;
    --bg-white: #ffffff;
    --bg-dark: #0f172a;
    
    /* Tekstivärit */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --text-white: #ffffff;
    
    /* Varjot */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    /* Mitat */
    --sidebar-width: 260px;
    --topbar-height: 70px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
}

/* === SIVUPALKKI NAVIGAATIO === */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-blue-dark) 0%, var(--primary-blue) 100%);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar-logo {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo h3 {
    color: var(--text-white);
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.sidebar-logo span {
    color: var(--primary-orange);
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-item {
    margin-bottom: 5px;
}

.nav-link-main {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.nav-link-main:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-white);
}

.nav-link-main.active {
    background-color: var(--primary-orange);
    color: var(--text-white);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
}

.nav-link-main i {
    margin-right: 12px;
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.nav-link-main .chevron {
    margin-left: auto;
    transition: transform 0.3s ease;
}

.nav-link-main.collapsed .chevron {
    transform: rotate(-90deg);
}

.nav-submenu {
    background-color: rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.nav-link-sub {
    display: block;
    padding: 10px 20px 10px 56px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link-sub::before {
    content: '';
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background-color: var(--primary-orange-light);
    border-radius: 50%;
    opacity: 0.5;
}

.nav-link-sub:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-white);
    padding-left: 60px;
}

.nav-link-sub:hover::before {
    opacity: 1;
}

/* === YLÄPALKKI === */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background-color: var(--bg-white);
    box-shadow: var(--shadow-md);
    z-index: 999;
    display: flex;
    align-items: center;
    padding: 0 30px;
}

.search-box {
    flex: 0 0 350px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px 15px 10px 45px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-blue-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 16px;
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 20px;
}

.notification-bell {
    position: relative;
    cursor: pointer;
}

.notification-bell i {
    font-size: 22px;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.notification-bell:hover i {
    color: var(--primary-orange);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--primary-orange);
    color: var(--text-white);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.notification-dropdown {
    position: absolute;
    top: 45px;
    right: 0;
    width: 350px;
    background-color: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: none;
    max-height: 400px;
    overflow-y: auto;
}

.notification-dropdown.show {
    display: block;
}

.notification-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
    color: var(--text-primary);
}

.notification-item {
    padding: 15px 20px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.notification-item:hover {
    background-color: var(--bg-main);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.notification-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.notification-time {
    font-size: 12px;
    color: var(--text-light);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px 15px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.user-profile:hover {
    background-color: var(--bg-main);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-blue-light), var(--primary-orange));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-white);
    font-weight: 700;
    font-size: 16px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

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

.user-role {
    font-size: 12px;
    color: var(--text-secondary);
}

/* === PÄÄSISÄLTÖ === */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 30px;
    min-height: calc(100vh - var(--topbar-height));
}

.page-header {
    margin-bottom: 30px;
}

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

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

/* === KORTIT === */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--bg-white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

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

.stat-card.blue {
    border-left-color: var(--primary-blue-light);
}

.stat-card.orange {
    border-left-color: var(--primary-orange);
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

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

.stat-icon {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-icon.blue {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--primary-blue-light);
}

.stat-icon.orange {
    background-color: rgba(249, 115, 22, 0.1);
    color: var(--primary-orange);
}

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

.stat-change {
    font-size: 13px;
    font-weight: 600;
}

.stat-change.positive {
    color: #10b981;
}

.stat-change.negative {
    color: #ef4444;
}

.stat-change i {
    margin-right: 4px;
}

/* === KAAVIOT === */
.chart-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    background-color: var(--bg-white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow-sm);
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--bg-main);
}

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

.chart-filter {
    display: flex;
    gap: 10px;
}

.filter-btn {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    background-color: var(--bg-white);
    color: var(--text-secondary);
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    border-color: var(--primary-blue-light);
    color: var(--primary-blue-light);
}

.filter-btn.active {
    background-color: var(--primary-blue-light);
    border-color: var(--primary-blue-light);
    color: var(--text-white);
}

.chart-container {
    position: relative;
    height: 300px;
}

/* === TAULUKKO === */
.table-card {
    background-color: var(--bg-white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto;
}

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

.custom-table thead {
    background-color: var(--bg-main);
}

.custom-table th {
    padding: 15px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.custom-table td {
    padding: 15px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-primary);
    font-size: 14px;
}

.custom-table tbody tr:hover {
    background-color: var(--bg-main);
}

.status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.status-badge.warning {
    background-color: rgba(249, 115, 22, 0.1);
    color: var(--primary-orange);
}

.status-badge.danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* === RESPONSIVE === */
@media (max-width: 992px) {
    .sidebar {
        width: 80px;
    }
    
    .sidebar-logo h3 {
        font-size: 20px;
    }
    
    .nav-link-main span,
    .nav-link-main .chevron {
        display: none;
    }
    
    .nav-link-sub {
        padding-left: 20px;
    }
    
    :root {
        --sidebar-width: 80px;
    }
    
    .topbar {
        left: 80px;
    }
    
    .main-content {
        margin-left: 80px;
    }
    
    .search-box {
        flex: 1;
    }
}

@media (max-width: 768px) {
    .chart-row {
        grid-template-columns: 1fr;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .topbar {
        padding: 0 15px;
    }
    
    .main-content {
        padding: 20px 15px;
    }
    
    .search-box {
        flex: 0 0 200px;
    }
    
    .user-info {
        display: none;
    }
}



.nav-link-sub.active {
    background-color: rgba(249, 115, 22, 0.15); /* Erittäin vaalean oranssi tausta */
    color: var(--text-white);
    padding-left: 60px;
    border-left: 3px solid var(--primary-orange); /* Oranssi reunaviiva vasemmalla */
}

.nav-link-sub.active::before {
    opacity: 1;
    background-color: var(--primary-orange); /* Kirkkaampi pallo */
}






