/**
 * Main Stylesheet
 * Brand colors and core styling
 */

/* Import fonts */
@import url('https://fonts.googleapis.com/css2?family=Lora:wght@400;700&family=Source+Sans+Pro:wght@400;600&display=swap');

/* Color Variables */
:root {
    --primary-red: #EE3E5A;
    --secondary-red: #CD2027;
    --tertiary-red: #FF505D;
    --black: #000000;
    --white: #FFFFFF;
    --light-grey: #F5F5F5;
    --medium-grey: #E0E0E0;
    --dark-grey: #666666;
}

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

html {
    overflow-x: hidden;
}

body {
    font-family: 'Source Sans Pro', Calibri, Lato, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--black);
    background-color: var(--light-grey);
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Lora', Calibri, Lato, serif;
    font-weight: 700;
    color: var(--black);
    margin-bottom: 1rem;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.9rem; }

/* Links */
a {
    color: var(--primary-red);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--secondary-red);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    min-height: 44px;
    min-width: 100px;
    box-sizing: border-box;
}

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

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

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

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

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-red);
    color: var(--primary-red);
}

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

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--black);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="url"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 15px;
    font-size: 16px;
    border: 1px solid var(--medium-grey);
    border-radius: 4px;
    font-family: 'Source Sans Pro', sans-serif;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 0 3px rgba(238, 62, 90, 0.1);
}

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

/* Alerts */
.alert {
    padding: 15px 20px;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    border-left: 4px solid;
}

.alert-error {
    background-color: #fee;
    border-color: var(--secondary-red);
    color: var(--secondary-red);
}

.alert-success {
    background-color: #efe;
    border-color: #28a745;
    color: #28a745;
}

.alert-info {
    background-color: #e3f2fd;
    border-color: #2196f3;
    color: #2196f3;
}

/* Cards - moved below for better specificity */

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Sidebar */
.sidebar {
    background-color: var(--white);
    width: 280px;
    max-width: 100%;
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    border-right: 2px solid var(--medium-grey);
    padding: 0;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    z-index: 1000;
    overflow-x: hidden;
    box-sizing: border-box;
}

.sidebar-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 2px solid var(--light-grey);
    background: linear-gradient(135deg, var(--white) 0%, var(--light-grey) 100%);
    text-align: center;
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
}

.logo-link {
    display: block;
    margin-bottom: 1rem;
    text-align: center;
    overflow: hidden;
    max-width: 100%;
}

.logo-img {
    max-width: 100%;
    width: auto;
    height: auto;
    max-height: 80px;
    display: block;
    margin: 0 auto;
    object-fit: contain;
}

.sidebar-header h2 {
    color: var(--primary-red);
    font-size: 1rem;
    margin: 0.5rem 0 0 0;
    font-weight: 600;
    line-height: 1.3;
    word-wrap: break-word;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0.75rem;
}

.sidebar-menu li {
    margin-bottom: 0.25rem;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    color: var(--black);
    transition: all 0.3s;
    font-weight: 500;
    border-left: 4px solid transparent;
    text-decoration: none;
    border-radius: 4px;
    margin: 0 0.25rem;
}

.sidebar-menu a .menu-icon {
    font-size: 1.2rem;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

.sidebar-menu a .menu-label {
    flex: 1;
}

.sidebar-menu a:hover {
    background-color: var(--light-grey);
    color: var(--primary-red);
    border-left-color: var(--tertiary-red);
}

.sidebar-menu a.active {
    background-color: var(--primary-red);
    color: var(--white);
    border-left-color: var(--secondary-red);
}

/* Main Content */
.main-content {
    margin-left: 280px;
    padding: 1.5rem 2rem 2rem;
    min-height: 100vh;
    background-color: var(--light-grey);
    position: relative;
    overflow-x: hidden;
}

/* Card improvements */
.card {
    background-color: var(--white);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-top: 3px solid var(--primary-red);
    transition: box-shadow 0.3s;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.card-header {
    border-bottom: 2px solid var(--light-grey);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.card-header h3 {
    margin-bottom: 0;
    color: var(--primary-red);
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.3;
}

/* Filters */
.filters-container {
    background-color: var(--white);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark-grey);
}

.filter-group select,
.filter-group input {
    padding: 10px 12px;
    border: 1px solid var(--medium-grey);
    border-radius: 4px;
    font-size: 14px;
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Charts */
.chart-container {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: relative;
    height: 400px;
}

.chart-container h3 {
    margin-bottom: 1.5rem;
    color: var(--primary-red);
    font-size: 1.25rem;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.chart-wrapper {
    background-color: var(--white);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.chart-wrapper h4 {
    margin-bottom: 1rem;
    color: var(--primary-red);
    font-size: 1rem;
}

.chart-wrapper canvas {
    max-height: 300px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
    margin-top: 0;
}

@media (max-width: 1400px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-red);
    margin-top: 0.75rem;
    line-height: 1.2;
}

.quick-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    padding: 1rem 0;
}

/* Header */
.header {
    background-color: var(--white);
    padding: 1rem 2rem;
    border-bottom: 2px solid var(--light-grey);
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-radius: 8px;
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
    position: relative;
    z-index: 10;
}

.header h1 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary-red);
    font-weight: 600;
    line-height: 1.3;
    word-wrap: break-word;
    flex: 1;
    min-width: 0;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-shrink: 0;
    margin-left: 1rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-right: 1rem;
    white-space: nowrap;
}

.user-info strong {
    color: var(--black);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
}

.user-role {
    font-size: 0.75rem;
    color: var(--dark-grey);
    text-transform: capitalize;
    line-height: 1.2;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--secondary-red) 50%, var(--tertiary-red) 100%);
    padding: 2rem 1rem;
}

.login-box {
    background-color: var(--white);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 450px;
    border-top: 4px solid var(--primary-red);
}

.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
    overflow: hidden;
    max-width: 100%;
}

.login-header img {
    max-width: 100%;
    height: auto;
}

.login-header p {
    font-size: 0.9rem;
    color: var(--dark-grey);
    margin-top: 0.25rem;
}

.login-logo {
    max-width: 60px;
    width: auto;
    height: auto;
    max-height: 60px;
    margin: 0 auto 1rem auto;
    display: block;
    object-fit: contain;
}

.login-header h1 {
    color: var(--primary-red);
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.4;
}

.login-form {
    margin-top: 2rem;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--white);
}

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--medium-grey);
}

.table th {
    background-color: var(--light-grey);
    font-weight: 600;
    color: var(--black);
}

.table tr:hover {
    background-color: var(--light-grey);
}

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

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

.badge-secondary {
    background-color: var(--secondary-red);
    color: var(--white);
}

.badge-success {
    background-color: #28a745;
    color: var(--white);
}

.badge-warning {
    background-color: #ffc107;
    color: var(--black);
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 24px;
    background-color: var(--light-grey);
    border-radius: 12px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-red);
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 12px;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        margin-left: 280px;
        padding: 1rem 1.5rem;
    }
    
    .header {
        padding: 0.875rem 1.5rem;
        flex-wrap: wrap;
    }
    
    .header h1 {
        font-size: 1.35rem;
        margin-bottom: 0.5rem;
    }
    
    .header-actions {
        width: 100%;
        margin-top: 0.5rem;
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 250px;
    }
    
    .main-content {
        margin-left: 250px;
        padding: 1rem;
    }
    
    .header {
        padding: 0.75rem 1rem;
    }
    
    .header h1 {
        font-size: 1.25rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .filters-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 100%;
        position: relative;
        min-height: auto;
    }
    
    .main-content {
        margin-left: 0;
        padding: 0.75rem;
    }
    
    .header {
        padding: 0.5rem 0.75rem;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header h1 {
        font-size: 1.1rem;
        width: 100%;
    }
    
    .header-actions {
        width: 100%;
        margin-top: 0.5rem;
        justify-content: space-between;
    }
    
    .logo-img {
        max-width: 100%;
        max-height: 60px;
        width: auto;
        height: auto;
        object-fit: contain;
    }
    
    .login-logo {
        max-width: 60px;
        max-height: 60px;
        width: auto;
        height: auto;
        object-fit: contain;
    }
    
    .sidebar-header h2 {
        font-size: 0.9rem;
    }
    
    /* Table responsiveness on mobile */
    .table {
        font-size: 14px;
    }
    
    .table th,
    .table td {
        padding: 8px 10px;
    }
    
    /* Ensure buttons are touch-friendly */
    .btn {
        min-height: 44px;
        padding: 12px 20px;
        font-size: 16px;
    }
    
    /* Form groups on mobile */
    .form-group {
        margin-bottom: 1.25rem;
    }
    
    /* Filters container on mobile */
    .filters-container {
        padding: 1rem;
    }
    
    .filters-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-actions {
        width: 100%;
        display: flex;
        gap: 0.5rem;
    }
    
    .filter-actions .btn {
        flex: 1;
    }
}

