/* Purple and Red Theme */
:root {
    --primary-color: #6a1b9a;      /* Deep Purple */
    --primary-light: #9c4dcc;     /* Lighter Purple */
    --primary-dark: #38006b;      /* Darker Purple */
    --secondary-color: #d32f2f;   /* Red */
    --secondary-light: #ff6659;   /* Lighter Red */
    --secondary-dark: #9a0007;    /* Darker Red */
    --accent-color: #ff4081;      /* Pink accent */
    --light-gray: #f5f0f7;        /* Very light purple tint */
    --dark-gray: #1a1a1a;         /* Darker text for better contrast */
    --text-color: #2c003e;        /* Very dark purple for text */
    --text-light: #757575;        /* Lighter text */
    --border-radius: 12px;
    --box-shadow: 0 10px 25px rgba(106, 27, 154, 0.2);
    --transition: all 0.3s ease;
}

/* Base Elements */
body {
    color: var(--text-color);
    background-color: #faf5ff;  /* Very light purple background */
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

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

/* Buttons */
.btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 0.8rem 1.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(106, 27, 154, 0.3);
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(106, 27, 154, 0.4);
}

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

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

.btn-primary {
    background: var(--secondary-color);
    box-shadow: 0 4px 15px rgba(211, 47, 47, 0.3);
}

.btn-primary:hover {
    background: var(--secondary-dark);
    box-shadow: 0 6px 20px rgba(211, 47, 47, 0.4);
}

/* Cards */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    overflow: hidden;
    border: 1px solid rgba(106, 27, 154, 0.1);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(106, 27, 154, 0.2);
}

/* Navigation */
.navbar {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.nav-link {
    color: white !important;
    font-weight: 500;
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    margin: 0 0.3rem;
}

.nav-link:hover, .nav-link.active {
    background: rgba(255, 255, 255, 0.2);
}

/* Forms */
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    border: 1px solid #e0e0e0;
    border-radius: var(--border-radius);
    padding: 0.8rem 1rem;
    width: 100%;
    transition: var(--transition);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(156, 77, 204, 0.2);
    outline: none;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #4caf50;
}

.alert-error {
    background-color: #ffebee;
    color: #c62828;
    border-left: 4px solid #f44336;
}

/* Sidebar */
.sidebar {
    background: linear-gradient(180deg, var(--primary-dark), var(--primary-color));
    color: white;
}

.sidebar-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 0.8rem 1.5rem;
    display: block;
    transition: var(--transition);
    border-radius: 0 30px 30px 0;
    margin: 0.3rem 0;
}

.sidebar-link:hover, .sidebar-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding-left: 2rem;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
}

tr:hover {
    background-color: #f9f9f9;
}

/* Utility Classes */
.bg-primary {
    background-color: var(--primary-color) !important;
    color: white;
}

.bg-secondary {
    background-color: var(--secondary-color) !important;
    color: white;
}

.text-primary {
    color: var(--primary-color) !important;
}

.text-secondary {
    color: var(--secondary-color) !important;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        width: 260px;
    }
    
    .btn {
        padding: 0.7rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .card {
        margin: 0.5rem;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        width: 100%;
        max-width: 320px;
        height: 100vh;
        left: -100%;
        transition: var(--transition);
        z-index: 1000;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    
    .btn {
        padding: 0.8rem 1.2rem;
        font-size: 0.85rem;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .card {
        margin: 0.25rem;
        padding: 1rem;
    }
    
    .navbar {
        padding: 0.5rem 1rem;
    }
    
    /* Container adjustments */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Grid adjustments */
    .grid {
        gap: 0.75rem;
    }
    
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    .grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .sidebar {
        max-width: 280px;
    }
    
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }
    
    .card {
        padding: 0.75rem;
        margin: 0.125rem;
    }
    
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    /* Typography adjustments */
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    h3 {
        font-size: 1.125rem;
    }
    
    /* Grid adjustments */
    .grid-cols-3 {
        grid-template-columns: 1fr;
    }
    
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    /* Form adjustments */
    input, textarea, select {
        padding: 0.6rem;
        font-size: 0.85rem;
    }
    
    /* Modal adjustments */
    .modal {
        padding: 1rem;
    }
    
    .modal-content {
        max-width: 95%;
        margin: 1rem auto;
    }
}

@media (max-width: 480px) {
    .sidebar {
        max-width: 100%;
    }
    
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .card {
        padding: 0.5rem;
        margin: 0.0625rem;
    }
    
    .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    /* Typography adjustments */
    h1 {
        font-size: 1.25rem;
    }
    
    h2 {
        font-size: 1.125rem;
    }
    
    h3 {
        font-size: 1rem;
    }
    
    /* Grid adjustments */
    .grid-cols-2 {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .grid-cols-4 {
        grid-template-columns: 1fr;
        gap: 0.375rem;
    }
    
    /* Form adjustments */
    input, textarea, select {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    /* Spacing adjustments */
    .mb-6 {
        margin-bottom: 1rem;
    }
    
    .mb-4 {
        margin-bottom: 0.75rem;
    }
    
    .p-4 {
        padding: 0.75rem;
    }
    
    .p-6 {
        padding: 1rem;
    }
    
    /* Button adjustments */
    .btn-primary {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }
    
    /* Modal adjustments */
    .modal {
        padding: 0.5rem;
    }
    
    .modal-content {
        max-width: 98%;
        margin: 0.5rem auto;
        padding: 0.75rem;
    }
    
    /* Navigation adjustments */
    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
}

/* Landscape orientation optimizations */
@media (max-width: 768px) and (orientation: landscape) {
    .sidebar {
        max-height: 100vh;
        overflow-y: auto;
    }
    
    .sidebar-header {
        padding: 0.75rem 1rem;
    }
    
    .nav-item {
        padding: 0.5rem 1rem;
    }
    
    .main-content {
        padding: 0.75rem;
    }
}

/* Small height optimizations */
@media (max-height: 600px) {
    .sidebar {
        overflow-y: auto;
    }
    
    .sidebar-header {
        padding: 1rem;
    }
    
    .nav-item {
        padding: 0.75rem 1rem;
    }
    
    .modal {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: none;
    }
    
    .card:hover {
        transform: none;
    }
    
    .nav-item:hover {
        background: transparent;
    }
    
    /* Increase touch targets */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-item {
        min-height: 44px;
        padding: 0.75rem 1rem;
    }
    
    input, textarea, select {
        min-height: 44px;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}
