/* Reset and Base Styles */
* {
    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;
}

#container {
    min-height: 100vh;
}

/* Common Styles */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
    line-height: 1.4;
    min-width: 120px;
}

button.btn {
  /* background: none; ← 削除 */
  border: none;
  cursor: pointer;
  appearance: none;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

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

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #218838;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    background: white;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Selectボックス専用のスタイル */
select.form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

select.form-control:focus {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%233b82f6' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

/* ブラウザデフォルトの矢印を完全に削除 */
select::-ms-expand {
    display: none;
}

/* Placeholder styling - 全フォーム共通 */
.form-control::placeholder {
    color: #d1d5db;
    opacity: 1;
    font-style: italic;
}

.form-control::-webkit-input-placeholder {
    color: #d1d5db;
    font-style: italic;
}

.form-control::-moz-placeholder {
    color: #d1d5db;
    opacity: 1;
    font-style: italic;
}

.form-control:-ms-input-placeholder {
    color: #d1d5db;
    font-style: italic;
}

/* Input要素全般のplaceholder */
input::placeholder,
textarea::placeholder {
    color: #d1d5db;
    opacity: 1;
    font-style: italic;
}

input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
    color: #d1d5db;
    font-style: italic;
}

input::-moz-placeholder,
textarea::-moz-placeholder {
    color: #d1d5db;
    opacity: 1;
    font-style: italic;
}

input:-ms-input-placeholder,
textarea:-ms-input-placeholder {
    color: #d1d5db;
    font-style: italic;
}

.error-message {
    color: #dc3545;
    font-size: 14px;
    margin-top: 5px;
    display: block;
}

.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 5px;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    background-color: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    color: #495057;
}

.card-body {
    padding: 20px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Login Page Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

.login-title {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

/* Dashboard Styles */
.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    background: white;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: #333;
    font-size: 28px;
    font-weight: 600;
}

.nav-menu {
    display: flex;
    gap: 20px;
}

.nav-menu a {
    text-decoration: none;
    color: #007bff;
    font-weight: 500;
    padding: 10px 15px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.nav-menu a:hover {
    background-color: #007bff;
    color: white;
}

/* Tenant Management Styles */
.floor-section {
    margin-bottom: 30px;
}

.floor-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 16px;
}

.tenant-item {
    background: white;
    border: 1px solid #dee2e6;
    padding: 15px 20px;
    display: grid;
    grid-template-columns: 2fr 2fr 1fr 1fr;
    gap: 15px;
    align-items: center;
    transition: all 0.3s ease;
}

.tenant-item:hover {
    background-color: #f8f9fa;
    transform: translateX(5px);
}

.tenant-item.not-moved-in {
    background-color: #fff3cd;
    border-color: #ffeaa7;
}

.tenant-name-jp {
    font-weight: 600;
    color: #333;
}

.tenant-name-en {
    color: #666;
    font-size: 14px;
}

.move-in-date {
    color: #e67e22;
    font-weight: 500;
}

/* Video Management Styles */
.video-item {
    background: white;
    border: 1px solid #dee2e6;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: grid;
    grid-template-columns: 2fr 2fr 1fr 1fr;
    gap: 15px;
    align-items: center;
    transition: all 0.3s ease;
}

.video-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.video-item.active {
    background-color: #ffffff;
    border-color: #28a745;
}

.video-item.upcoming {
    background-color: #e3f2fd;
    border-color: #2196f3;
}

.video-name {
    font-weight: 600;
    color: #333;
}

.video-period {
    color: #666;
    font-size: 14px;
}

/* Form Styles */
.form-container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.form-title {
    margin-bottom: 30px;
    color: #333;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.file-upload {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-upload:hover {
    border-color: #007bff;
    background-color: #f8f9fa;
}

.file-upload input[type="file"] {
    display: none;
}

.file-upload-text {
    color: #666;
    font-size: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-container {
        padding: 10px;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .tenant-item,
    .video-item {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .login-card {
        margin: 20px;
        padding: 30px;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.d-flex {
    display: flex;
}

.justify-content-between {
    justify-content: space-between;
}

.align-items-center {
    align-items: center;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 1rem;
}

/* Enhanced Animations and Transitions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* Page Load Animations */
.dashboard-container {
    animation: fadeIn 0.6s ease-out;
}

.card {
    animation: slideIn 0.5s ease-out;
}

.card:nth-child(2) {
    animation-delay: 0.1s;
}

.card:nth-child(3) {
    animation-delay: 0.2s;
}

/* Enhanced Button Styles */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #007bff, #0056b3);
}

.btn-success {
    background: linear-gradient(135deg, #28a745, #1e7e34);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

/* Enhanced Form Styles */
.form-control {
    position: relative;
    background: white;
}

.form-control:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

.form-group {
    position: relative;
}

.form-label {
    position: relative;
    z-index: 1;
}

/* Enhanced Card Styles */
.card {
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Enhanced Navigation */
.nav-menu a {
    position: relative;
    overflow: hidden;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: #007bff;
    transition: width 0.3s ease;
}

.nav-menu a:hover::after {
    width: 100%;
}

/* Enhanced Floor Section */
.floor-header {
    position: relative;
    overflow: hidden;
}

.floor-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.8s;
}

.floor-section:hover .floor-header::before {
    left: 100%;
}

/* Enhanced Video Item Styles */
.video-item {
    position: relative;
    overflow: hidden;
}

.video-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: #dee2e6;
    transition: all 0.3s ease;
}

.video-item.active::before {
    background: #28a745;
    width: 6px;
}

.video-item.upcoming::before {
    background: #2196f3;
    width: 6px;
}

.video-item.expired::before {
    background: #999;
    width: 6px;
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced Modal */
.modal {
    backdrop-filter: blur(5px);
}

.modal-content {
    animation: fadeIn 0.3s ease-out;
    border: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Status Indicators */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-active .status-indicator {
    background: #28a745;
    animation: pulse 2s infinite;
}

.status-upcoming .status-indicator {
    background: #2196f3;
}

.status-expired .status-indicator {
    background: #999;
}

/* Enhanced File Upload */
.file-upload {
    position: relative;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
}

.file-upload:hover {
    background: linear-gradient(145deg, #e9ecef, #f8f9fa);
}

.file-upload.dragover {
    background: linear-gradient(145deg, #e3f2fd, #bbdefb);
    transform: scale(1.02);
}

/* Progress Bar Enhancement */
.progress-bar {
    background: linear-gradient(90deg, #f8f9fa, #e9ecef);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    background: linear-gradient(90deg, #007bff, #0056b3);
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.2) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.2) 75%,
        transparent 75%,
        transparent
    );
    background-size: 50px 50px;
    animation: move 2s linear infinite;
}

@keyframes move {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 50px 50px;
    }
}

/* Enhanced Responsive Design */
@media (max-width: 1200px) {
    .dashboard-container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 24px;
    }
}

@media (max-width: 992px) {
    .tenant-item,
    .video-item {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        gap: 10px;
    }
}

@media (max-width: 576px) {
    .dashboard-container {
        padding: 10px;
    }
    
    .header {
        padding: 15px;
        margin: 0;
        margin-bottom: 20px;
    }
    
    .header h1 {
        font-size: 20px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .form-container {
        padding: 20px;
    }
    
    .btn {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .tenant-item,
    .video-item {
        grid-template-columns: 1fr;
        padding: 15px;
    }
    
    .floor-header {
        padding: 12px 15px;
        font-size: 14px;
    }
}

/* Print Styles */
@media print {
    .nav-menu,
    .btn,
    .form-actions {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .dashboard-container {
        padding: 0;
    }
    
    .header {
        border-bottom: 2px solid #333;
        margin-bottom: 20px;
    }
}

/* Accessibility Enhancements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .card {
        border: 2px solid #333;
    }
    
    .form-control {
        border: 2px solid #333;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* --- Navigation Buttons Fix --- */
a.nav-btn,
a.nav-btn:link,
a.nav-btn:visited {
    color: #fff !important;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 6px;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

/* バリエーション（色ごとに調整） */
a.nav-btn {
    background-color: #007bff;
}
a.nav-btn:hover,
a.nav-btn:focus {
    background-color: #0056b3;
    color: #fff !important;
    transform: translateY(-1px);
}

a.nav-btn.nav-btn-logout {
    background-color: #dc3545;
}
a.nav-btn.nav-btn-logout:hover {
    background-color: #c82333;
}

/* 必要なら追加バリエーション */
a.nav-btn.nav-btn-secondary {
    background-color: #6c757d;
}
a.nav-btn.nav-btn-secondary:hover {
    background-color: #545b62;
}
/* --- Button Text Color Fix --- */
.btn-primary,
.btn-primary:link,
.btn-primary:visited,
.btn-danger,
.btn-danger:link,
.btn-danger:visited,
.btn-secondary,
.btn-secondary:link,
.btn-secondary:visited {
  color: #fff !important;
  text-decoration: none;
}

/* Hover時も常に白を維持 */
.btn-primary:hover,
.btn-primary:focus,
.btn-danger:hover,
.btn-danger:focus,
.btn-secondary:hover,
.btn-secondary:focus {
  color: #fff !important;
  text-decoration: none;
}

/* ----- Button Final Overrides ----- */
/* anchor でも button でも白文字を維持（visited/hover含む） */
a.btn, button.btn { text-decoration: none; }

.btn-primary,
.btn-primary:link, .btn-primary:visited,
button.btn.btn-primary {
  color: #fff !important;
  background: linear-gradient(135deg, #007bff, #0056b3) !important;
}

.btn-danger,
.btn-danger:link, .btn-danger:visited,
button.btn.btn-danger {
  color: #fff !important;
  background: linear-gradient(135deg, #dc3545, #c82333) !important;
}

.btn-secondary,
.btn-secondary:link, .btn-secondary:visited,
button.btn.btn-secondary {
  color: #fff !important;
  background: #6c757d !important;
}

/* Hover/Focus でも白文字キープ */
.btn-primary:hover, .btn-primary:focus,
.btn-danger:hover,  .btn-danger:focus,
.btn-secondary:hover, .btn-secondary:focus {
  color: #fff !important;
}
