/* Base Styles */
:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --gray-color: #95a5a6;
    --white-color: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Dark Mode Variables */
:root.dark-mode {
    --dark-color: #ffffff;
    --light-color: #2c3e50;
    --white-color: #34495e;
    --gray-color: #bdc3c7;
    --shadow: 0 4px 6px rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    transition: background-color 0.3s, color 0.3s;
}

body.dark-mode {
    background-color: #2c3e50;
    color: #000000;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Loading Screen Styles */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeOut 2s forwards;
    animation-delay: 2s;
}

.loading-content {
    text-align: center;
    color: #fff;
    animation: pulse 1.5s infinite;
}

.loading-content h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.loading-content p {
    font-size: 1.2rem;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; display: none; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Header Styles */
header {
    background-color: var(--dark-color);
    color: var(--white-color);
    padding: 1rem 0;
    box-shadow: var(--shadow);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.8rem;
}

nav {
    display: flex;
}

nav ul {
    display: flex;
    list-style: none;
    align-items: center;
}

nav ul li {
    margin-left: 1.5rem;
}

nav ul li a {
    color: var(--white-color);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 0;
    transition: color 0.3s;
}

nav ul li a:hover {
    color: var(--primary-color);
}

nav ul li a.active {
    color: var(--secondary-color);
    border-bottom: 2px solid var(--secondary-color);
}

.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.hamburger span {
    width: 100%;
    height: 3px;
    background-color: var(--white-color);
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Main Content Styles */
main {
    padding: 2rem 0;
}

h2 {
    color: var(--dark-color);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

h3 {
    color: var(--dark-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

/* Dashboard Styles */
.dashboard {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background-color: var(--white-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-card h3 {
    color: var(--gray-color);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.stat-card p {
    font-size: 2rem;
    font-weight: bold;
    color: var(--dark-color);
}

.alert-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.alert-section {
    background-color: var(--white-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    width: 100%; /* Ensure full width adaptability */
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    margin-top: 1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

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

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

tr:nth-child(even) {
    background-color: #f9f9f9;
}

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

/* Button Styles */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

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

.btn.primary:hover {
    background-color: #2980b9;
}

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

.btn.secondary:hover {
    background-color: #27ae60;
}

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

.btn.danger:hover {
    background-color: #c0392b;
}

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

.btn.warning:hover {
    background-color: #e67e22;
}

.btn.theme-toggle {
    background-color: var(--gray-color);
    color: var(--white-color);
    width: 100%;
    text-align: left;
}

.btn.theme-toggle:hover {
    background-color: #7f8c8d;
}

.btn.small {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    background-color: var(--white-color);
    color: var(--dark-color);
}

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

.search-filter {
    display: flex;
    gap: 1rem;
}

.search-filter input {
    flex: 1;
    min-width: 200px;
}

/* Inventory Management Styles */
.inventory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

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

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    background-color: var(--white-color);
    margin: 5% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
}

.close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--gray-color);
    cursor: pointer;
}

.close:hover {
    color: var(--dark-color);
}

/* Report Styles */
.report-filters {
    background-color: var(--white-color);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.filter-group {
    min-width: 200px;
    flex: 1;
}

.report-results {
    background-color: var(--white-color);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.alert-settings {
    background-color: var(--white-color);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

/* Utility Classes */
.text-danger {
    color: var(--danger-color);
}

.text-warning {
    color: var(--warning-color);
}

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

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 500;
}

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

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

/* Responsive Adjustments */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .inventory-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .search-filter {
        width: 100%;
    }

    nav {
        display: none;
        position: fixed;
        top: 0;
        right: 0;
        width: 250px;
        height: 100%;
        background-color: var(--dark-color);
        padding: 4rem 1rem 1rem;
        box-shadow: -2px 0 5px rgba(0, 0, 0, 0.2);
        z-index: 1000;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
    }

    nav.active {
        display: block;
        transform: translateX(0);
    }

    nav ul {
        flex-direction: column;
        gap: 1rem;
    }

    nav ul li {
        margin-left: 0;
        margin-bottom: 0.5rem;
    }

    nav ul li a, nav ul li button {
        display: block;
        width: 100%;
        text-align: left;
        padding: 0.5rem;
    }

    .hamburger {
        display: flex;
    }
}

@media (max-width: 480px) {
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* Footer Styles */
footer {
    background-color: var(--dark-color);
    color: var(--white-color);
    padding: 1.5rem 0;
    margin-top: 2rem;
    position: sticky;
    top: 100vh;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

footer p {
    margin: 0;
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: var(--light-color);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: var(--primary-color);
}

/* Ensure content pushes footer to bottom */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}
