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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    background: #f5f7fa;
    min-height: 100vh;
    overflow-x: hidden;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: width 0.3s ease;
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    position: relative;
}

.sidebar-title-container {
    flex: 1;
    min-width: 0;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .sidebar-title-container {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    left: -9999px;
}

.sidebar-title {
    font-size: 24px;
    font-weight: 700;
    color: white;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-subtitle {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    padding: 0;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.toggle-icon {
    font-size: 14px;
    transition: transform 0.3s ease;
    display: inline-block;
}

.sidebar.collapsed .toggle-icon {
    transform: rotate(180deg);
}

.sidebar-nav {
    padding: 16px 0;
    flex: 1;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-left-color: #4A90E2;
    font-weight: 600;
}

.nav-icon {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.nav-text {
    flex: 1;
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 14px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px;
    padding-bottom: 320px; /* Add padding for log container */
    max-width: calc(100vw - 260px);
    min-height: 100vh;
    transition: margin-left 0.3s ease, max-width 0.3s ease;
}

.sidebar.collapsed ~ .main-content {
    margin-left: 70px;
    max-width: calc(100vw - 70px);
}

.page-content {
    animation: fadeIn 0.3s ease;
}

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

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

.page-header h2 {
    font-size: 28px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.page-description {
    font-size: 15px;
    color: #666;
    line-height: 1.6;
}

/* Card */
.card {
    background: white;
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 24px;
    border: 1px solid #e9ecef;
    transition: box-shadow 0.3s ease;
}

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

.card h3 {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #4A90E2;
}

/* Status Info */
.status-info {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid #dee2e6;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 8px 0;
}

.status-item:last-child {
    margin-bottom: 0;
}

.status-label {
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.status-value {
    color: #4A90E2;
    font-weight: 700;
    font-size: 16px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, #4A90E2 0%, #2980b9 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #2980b9 0%, #1e6fa8 100%);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(41, 128, 185, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-icon {
    font-size: 18px;
}

/* Form Elements */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 14px;
}

.input,
.select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
}

.input:focus,
.select:focus {
    outline: none;
    border-color: #4A90E2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* Date Range Container */
.date-range-container {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}

.date-input {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
    font-size: 15px;
}

.date-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.7;
    margin-left: 4px;
    transition: opacity 0.2s;
}

.date-input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

.date-separator {
    color: #666;
    font-weight: 600;
    font-size: 16px;
    min-width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.date-hint {
    color: #666;
    display: block;
    font-size: 12px;
    line-height: 1.5;
    margin-top: 8px;
    padding-left: 2px;
}

/* Log Container */
.log-container {
    position: fixed;
    bottom: 0;
    left: 260px;
    right: 0;
    width: calc(100% - 260px);
    max-height: 300px;
    background: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    overflow: hidden;
    z-index: 999;
    transition: max-height 0.3s ease, left 0.3s ease, width 0.3s ease;
}

/* Log container adjustment when sidebar is collapsed */
body:has(.sidebar.collapsed) .log-container {
    left: 70px;
    width: calc(100% - 70px);
}

.log-container.collapsed {
    max-height: 48px;
}

.log-container.collapsed .log-content {
    display: none;
}

.log-header {
    background: linear-gradient(135deg, #4A90E2 0%, #2980b9 100%);
    color: white;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.log-toggle {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.log-container.collapsed .log-toggle {
    transform: rotate(-90deg);
}

.log-content {
    padding: 16px;
    max-height: 260px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
}

.log-empty {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.log-entry {
    margin-bottom: 10px;
    padding: 10px 12px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #4A90E2;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.log-entry.success {
    border-left-color: #28a745;
}

.log-entry.error {
    border-left-color: #dc3545;
}

.log-entry.warning {
    border-left-color: #ffc107;
}

.log-time {
    color: #999;
    font-size: 11px;
    margin-right: 8px;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar,
.log-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track,
.log-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

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

.sidebar::-webkit-scrollbar-thumb:hover,
.log-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1001;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    transform: scale(1.05);
}

.hamburger-icon {
    display: block;
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }
    
    .sidebar {
        width: 260px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .sidebar.collapsed {
        width: 70px;
    }
    
    /* Hide sidebar toggle (collapse icon) when sidebar is closed on mobile */
    .sidebar:not(.mobile-open) .sidebar-toggle {
        display: none;
    }
    
    /* Show sidebar toggle when sidebar is open on mobile */
    .sidebar.mobile-open .sidebar-toggle {
        display: flex;
    }
    
    .main-content {
        margin-left: 0;
        max-width: 100vw;
        padding: 20px;
        padding-top: 80px; /* Space for mobile menu button */
        padding-bottom: 200px; /* Space for log container */
    }
    
    .log-container {
        left: 0;
        right: 0;
        width: 100%;
        max-height: 200px; /* Reduced height on mobile */
    }
    
    .log-content {
        max-height: 160px; /* Reduced content height */
    }
    
    .page-header h2 {
        font-size: 24px;
    }
    
    .card {
        padding: 20px;
    }
    
    .date-range-container {
        flex-direction: column;
        gap: 8px;
    }
    
    .date-separator {
        display: none;
    }
}
