:root {
    --bg-color: #121214;
    --text-color: #f1f1f1;
    --accent-blue: #4a90e2;
    --accent-red: #e74c3c;
    --accent-green: #2ecc71;
    --accent-yellow: #f1c40f;
    --accent-cyan: #3dd6f5;
    
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at top right, rgba(74, 144, 226, 0.15), transparent 40%),
                      radial-gradient(circle at bottom left, rgba(142, 68, 173, 0.1), transparent 40%);
    background-attachment: fixed;
    color: var(--text-color);
    min-height: 100vh;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(18, 18, 20, 0.95);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease;
}

.spinner {
    width: 60px; height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.loading-text {
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.5;
}

/* Base Utility */
.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.glass-header {
    background: rgba(20, 20, 25, 0.6);
    border-bottom: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    padding: 15px 30px;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.logo h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.badge {
    background: linear-gradient(135deg, #FFD700, #F39C12);
    color: #000;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 12px;
    vertical-align: middle;
    margin-left: 8px;
}

/* Control Panel */
.control-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 15px 20px;
    margin-bottom: 20px;
    align-items: center;
    justify-content: space-between;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.modern-select {
    background: #2a2d2e;
    color: white;
    border: 1px solid var(--glass-border);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    cursor: pointer;
}

/* Buttons */
.action-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 0.95rem;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.upload-btn { background: #34495e; color: white; display: inline-block; }
.download-btn { background: #27ae60; color: white; }
.cloud-save-btn { background: #8e44ad; color: white; }
.cloud-save-btn:disabled { background: #555; cursor: not-allowed; opacity: 0.5; }

.status-msg {
    font-size: 0.9rem;
    color: #aaa;
}

/* Tabs */
.tabs-nav {
    display: flex;
    padding: 10px;
    margin-bottom: 25px;
    gap: 10px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: 1px solid transparent;
    color: #aaa;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.tab-btn.active {
    background: rgba(74, 144, 226, 0.2);
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
}

.tab-content { display: none; animation: fadeIn 0.4s ease; }
.tab-content.active { display: block; }

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

/* Grid Layouts */
.grid-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

@media (max-width: 800px) {
    .grid-container { grid-template-columns: 1fr; }
}

.card {
    padding: 20px;
}

.card h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
}

.hint {
    font-size: 0.8rem;
    color: #aaa;
    font-weight: normal;
}

/* Border Accents */
.border-blue h3 { color: var(--accent-blue); border-bottom-color: rgba(74, 144, 226, 0.3); }
.border-red h3 { color: var(--accent-red); border-bottom-color: rgba(231, 76, 60, 0.3); }
.border-cyan h3 { color: var(--accent-cyan); border-bottom-color: rgba(61, 214, 245, 0.3); }
.border-yellow h3 { color: var(--accent-yellow); border-bottom-color: rgba(241, 196, 15, 0.3); }
.border-green h3 { color: var(--accent-green); border-bottom-color: rgba(46, 204, 113, 0.3); }

/* Input Fields */
.input-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    transition: background 0.2s;
    border-radius: 6px;
    padding: 5px;
}

.input-row:hover { background: rgba(255, 255, 255, 0.05); }

.input-label {
    flex: 1;
    font-size: 0.95rem;
    padding-right: 15px;
}

.modern-input {
    width: 180px;
    background: #222;
    border: 1px solid #444;
    color: #fff;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
}

.modern-input:focus {
    border-color: var(--accent-blue);
    outline: none;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 15px;
}

/* Caution Panel */
.caution-panel {
    margin-top: -10px;
    margin-bottom: 25px;
    padding: 12px 20px;
    background: rgba(231, 76, 60, 0.05);
    border-left: 4px solid var(--accent-red);
}

.caution-row {
    margin: 5px 0;
    font-size: 0.85rem;
    color: #ccc;
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none; /* JSで制御 */
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

/* Active class to show modal via JS */
.modal-overlay.active {
    display: flex;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    padding: 30px;
    border: 1px solid var(--glass-border);
}

.modal-content h2 {
    margin-top: 0;
    font-size: 1.3rem;
    color: var(--accent-blue);
}

.file-list-container {
    max-height: 300px;
    overflow-y: auto;
    margin: 20px 0;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}

.file-item {
    padding: 12px 15px;
    border-bottom: 1px solid var(--glass-border);
    cursor: pointer;
    transition: background 0.2s;
}

.file-item:hover {
    background: rgba(74, 144, 226, 0.15);
}

.file-item:last-child {
    border-bottom: none;
}

.modal-footer {
    text-align: right;
}

/* Footer Action */
.action-footer {
    margin-top: 40px;
    text-align: center;
    padding: 20px;
}

.btn-primary {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 30px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.4);
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(46, 204, 113, 0.6);
}

.message-area {
    margin-top: 15px;
    color: #aaa;
}

/* Excel Style Table */
.excel-table {
    border-collapse: collapse;
    width: 100%;
    color: white;
    font-size: 0.9rem;
    white-space: nowrap;
}
.excel-table th, .excel-table td {
    border: 1px solid #444;
    padding: 8px 12px;
}
.excel-table th {
    background: #333;
    font-weight: bold;
    color: #aadcff;
    position: sticky;
    top: 0;
    z-index: 10;
}
.table-row-odd { background: rgba(255, 255, 255, 0.02); }
.table-row-even { background: rgba(0, 0, 0, 0.2); }
