@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700;900&display=swap');

:root {
    --primary-navy: #1e293b;
    --primary-blue: #2563eb;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --neutral-slate: #64748b;
    --bg-light: #f8fafc;
    --border-color: #e2e8f0;
    --shadow-main: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --font-main: 'Noto Sans JP', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-light);
    color: var(--primary-navy);
    line-height: 1.5;
    padding-bottom: 50px;
}

header {
    background-color: var(--primary-navy);
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-main);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

header h1 span {
    background: linear-gradient(135deg, var(--accent-orange), var(--accent-red));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-badge {
    font-size: 0.8rem;
    font-weight: 700;
    background-color: rgba(255, 255, 255, 0.15);
    padding: 5px 12px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-logout {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.4);
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.1);
    border-color: white;
}

.container {
    max-width: 1200px;
    margin: 1.5rem auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 1024px) {
    .container {
        grid-template-columns: 3fr 1fr;
    }
}

.card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-main);
    padding: 1.5rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--bg-light);
    padding-bottom: 0.5rem;
}

/* Goals Component */
.goals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.goal-item {
    background: var(--bg-light);
    padding: 1rem;
    border-radius: 10px;
    text-align: center;
    border: 1px solid var(--border-color);
    position: relative;
}

.goal-label {
    font-size: 0.85rem;
    color: var(--neutral-slate);
    font-weight: bold;
    margin-bottom: 5px;
}

.goal-values {
    font-size: 1.5rem;
    font-weight: 900;
    margin-bottom: 8px;
}

.goal-values span {
    font-size: 0.9rem;
    color: var(--neutral-slate);
    font-weight: normal;
}

.progress-container {
    background: #e2e8f0;
    height: 8px;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    background: var(--primary-blue);
    height: 100%;
    width: 0%;
    transition: width 0.4s ease;
}

.goal-item:nth-child(2) .progress-bar {
    background: var(--accent-orange);
}

.goal-item:nth-child(3) .progress-bar {
    background: var(--accent-green);
}

/* Alerts Component */
.alert-banner {
    background: #fef2f2;
    border: 1px solid #fee2e2;
    border-left: 5px solid var(--accent-red);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.alert-header {
    font-size: 0.95rem;
    font-weight: 700;
    color: #991b1b;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
}

.alert-row {
    background: white;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #fee2e2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.alert-row:hover {
    background: #fff5f5;
}

/* Calendar Component */
.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.calendar-title {
    font-size: 1.25rem;
    font-weight: 900;
}

.calendar-btn {
    background: white;
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.calendar-btn:hover {
    background: var(--bg-light);
    border-color: #cbd5e1;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-header-cell {
    text-align: center;
    font-weight: bold;
    font-size: 0.8rem;
    color: var(--neutral-slate);
    padding: 8px 0;
    background: var(--bg-light);
    border-radius: 4px;
}

.calendar-header-cell:nth-child(7) {
    color: #3b82f6; /* Sat */
}

.calendar-header-cell:nth-child(1) {
    color: #ef4444; /* Sun */
}

.calendar-day-cell {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-height: 90px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.calendar-day-cell:hover {
    background: #f1f5f9;
}

.calendar-day-cell.other-month {
    opacity: 0.4;
    background: #f8fafc;
}

.calendar-day-cell.today {
    border: 2px solid var(--primary-blue);
    background: #eff6ff;
}

.day-number {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-navy);
}

.calendar-day-cell.other-month .day-number {
    font-weight: normal;
}

.calendar-day-cell:nth-child(7n) .day-number {
    color: #2563eb; /* Sat */
}

.calendar-day-cell:nth-child(7n-6) .day-number {
    color: #dc2626; /* Sun */
}

.appointment-item-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow: hidden;
}

.appointment-badge {
    font-size: 0.65rem;
    padding: 4px 6px;
    border-radius: 4px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    margin-bottom: 2px;
    border: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Status colors */
.status-before {
    background: #3b82f6;
    color: white;
}

.status-waiting {
    background: #f59e0b;
    color: white;
}

.status-contract {
    background: #10b981;
    color: white;
}

.status-nocontract {
    background: #94a3b8;
    color: white;
}

.status-site-start {
    background: #6366f1;
    color: white;
}

.status-site-end {
    background: #ec4899;
    color: white;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 900;
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--neutral-slate);
}

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

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 0.95rem;
    background: white;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 1.5rem;
}

.btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--neutral-slate);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

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

.btn-primary:hover {
    background: #0f172a;
}

.btn-success {
    background: var(--accent-green);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

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

.btn-danger:hover {
    background: #dc2626;
}

/* Authentication Overlay */
#authOverlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--primary-navy);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.auth-card {
    background: white;
    border-radius: 16px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    font-size: 1.8rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
}

.auth-logo span {
    background: linear-gradient(135deg, var(--accent-orange), var(--accent-red));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-subtitle {
    font-size: 0.85rem;
    color: var(--neutral-slate);
    margin-bottom: 2rem;
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: var(--primary-blue);
    color: white;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    z-index: 90;
    transition: transform 0.2s, background-color 0.2s;
    font-size: 1.25rem;
    border: none;
}

.fab:hover {
    transform: scale(1.05);
    background-color: #1d4ed8;
}

.info-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f0fdf4;
    border: 1px solid #dcfce7;
    border-radius: 6px;
    color: #166534;
    font-size: 0.8rem;
    margin-top: 10px;
    font-weight: bold;
}
