/* static/css/base.css */
/* Base CSS for Harumiki Smart Farm
Bootstrap-based responsive design */

/* ========== CSS Variables ========== */
:root {
    --sidebar-width: 250px;
    --primary-color: #7380ec;
    --primary-hover: #5a6ad8;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --info-color: #17a2b8;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-bg: #f8f9fa;
    --hover-bg: #f4f4f8;
    --border-color: #dee2e6;
    --text-primary: #333333;
    --text-secondary: #6c757d;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
    --shadow-md: 0 0.5rem 1rem rgba(0,0,0,0.15);
    --transition: all 0.3s ease;
}

/* ========== Base Styles ========== */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--light-bg);
}

/* ========== Sidebar ========== */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    width: var(--sidebar-width);
    background-color: white;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--transition);
}

.sidebar-logo {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    background-color: white;
}

.sidebar-logo img {
    max-width: 180px;
    height: auto;
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-nav .nav-link {
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: var(--transition);
    border: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
}

.sidebar-nav .nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: var(--primary-color);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.sidebar-nav .nav-link:hover {
    background-color: var(--hover-bg);
    color: var(--primary-color);
    padding-left: 2rem;
}

.sidebar-nav .nav-link:hover::before {
    transform: translateX(0);
}

.sidebar-nav .nav-link.active {
    background-color: var(--hover-bg);
    color: var(--primary-color);
    font-weight: 600;
}

.sidebar-nav .nav-link.active::before {
    transform: translateX(0);
}

.sidebar-nav .nav-link i {
    font-size: 1.25rem;
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

/* ========== Main Content ========== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background-color: var(--light-bg);
    transition: var(--transition);
}

/* ========== Page Header ========== */
.page-header {
    background-color: white;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-color);
}

.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.page-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: flex-end;
}

.btn-farm {
    min-width: 100px;
}

/* ========== Content Container ========== */
.content-container {
    padding: 0 1.5rem 2rem;
}

/* ========== Cards ========== */
.card {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background-color: var(--light-bg);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

/* ========== Footer ========== */
.footer {
    background-color: white;
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    margin-top: auto;
    color: var(--text-secondary);
}

/* ========== Loading Overlay ========== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.loading-overlay.show {
    display: flex;
}

.loading-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* ========== Mobile Navigation Toggle ========== */
.mobile-nav-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 101;
    background: white;
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.mobile-nav-toggle:hover {
    background-color: var(--light-bg);
}

/* ========== Responsive Design ========== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
        box-shadow: var(--shadow-md);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-nav-toggle {
        display: block;
    }

    .page-header {
        padding: 1rem;
        padding-left: 4rem;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .page-controls {
        flex-wrap: wrap;
        justify-content: center;
        margin-top: 1rem;
    }

    .content-container {
        padding: 0 1rem 2rem;
    }
}

@media (max-width: 576px) {
    .page-controls .btn {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }

    .btn-farm {
        min-width: 80px;
    }
}

/* ========== Utility Classes ========== */
.text-primary-custom {
    color: var(--primary-color) !important;
}

.bg-primary-custom {
    background-color: var(--primary-color) !important;
}

.shadow-hover {
    transition: var(--transition);
}

.shadow-hover:hover {
    box-shadow: var(--shadow-md) !important;
}

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

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

/* ========== Custom Scrollbar ========== */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--light-bg);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ========== Alert Styles ========== */
.alert {
    border: none;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.alert-dismissible .btn-close {
    padding: 0.5rem;
}

/* ========== Button Enhancements ========== */
.btn {
    font-weight: 500;
    transition: var(--transition);
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-group .btn {
    border-radius: 0.375rem;
}

.btn-group .btn:first-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.btn-group .btn:last-child {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* ========== Loading Overlay Styles ========== */
.loading-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loading-overlay.show {
    display: flex;
}

.loading-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
}