/* 両毛精密 基幹システム - 共通スタイル */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --text-dark: #1e293b;
    --text-gray: #64748b;
    --border: #e2e8f0;
    --bg-gray: #f8fafc;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --sidebar-width: 250px;
}

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

body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: var(--text-dark);
    background-color: var(--bg-gray);
    line-height: 1.5;
}

/* サイドバー */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #1e3a5f 0%, #0f172a 100%);
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h1 {
    font-size: 20px;
    font-weight: 600;
}

.sidebar-header .subtitle {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
}

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

.nav-section {
    padding: 16px 20px 8px;
    font-size: 11px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    letter-spacing: 0.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.2s;
}

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

.nav-item.active {
    background: var(--primary);
    color: white;
}

.nav-item .icon {
    width: 24px;
    margin-right: 12px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
}

.user-info .icon {
    margin-right: 8px;
}

.logout-btn {
    display: block;
    padding: 8px 16px;
    background: rgba(255,255,255,0.1);
    color: white;
    text-decoration: none;
    text-align: center;
    border-radius: 4px;
    font-size: 13px;
}

.logout-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* メインコンテンツ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.page-header {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    background: white;
    border-bottom: 1px solid var(--border);
}

.page-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.header-actions {
    margin-left: auto;
    display: flex;
    gap: 12px;
}

.content {
    padding: 24px;
}

/* ボタン */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: white;
    color: var(--text-dark);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-gray);
}

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

.btn-block {
    width: 100%;
}

/* フォーム */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    color: var(--text-gray);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
}

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

/* テーブル */
.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg-gray);
    font-weight: 600;
    color: var(--text-gray);
    font-size: 12px;
    text-transform: uppercase;
}

tr:hover {
    background: var(--bg-gray);
}

/* カード */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 20px;
}

/* ダッシュボード */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.dashboard-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 24px;
}

.dashboard-card h3 {
    margin-bottom: 16px;
    color: var(--text-gray);
    font-size: 14px;
    text-transform: uppercase;
}

.card-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-link {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--bg-gray);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-dark);
    transition: all 0.2s;
}

.card-link:hover {
    background: var(--primary);
    color: white;
}

.card-link .icon {
    margin-right: 12px;
    font-size: 20px;
}

/* アラート */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.alert-error {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: var(--success);
    border: 1px solid #bbf7d0;
}

/* ローディング */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

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

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 成功モーダル */
.success-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: white;
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 1001;
}

.success-modal.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.success-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.success-icon {
    width: 60px;
    height: 60px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 16px;
}

/* ログインページ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}

.login-box h1 {
    text-align: center;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.login-box .subtitle {
    text-align: center;
    color: var(--text-gray);
    margin-bottom: 32px;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.open {
        transform: translateX(0);
    }

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

    .menu-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 24px;
        cursor: pointer;
        margin-right: 16px;
    }

    .desktop-only {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }

    .menu-toggle {
        display: none;
    }
}
