:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --accent-color: #38bdf8;
    --accent-glow: rgba(56, 189, 248, 0.5);
    --in-color: #4ade80;
    --out-color: #f87171;
    --req-color: #facc15;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --font-main: 'Inter', 'Noto Sans JP', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at top right, #1e293b, #0f172a);
}

.app-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

main {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.main-layout {
    display: flex;
    gap: 2rem;
    align-items: center;
    justify-content: center;
    width: 90%;
    max-width: 1400px;
    max-height: 600px;
}

.left-section {
    flex: 1;
    max-width: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.main-logo {
    width: 100%;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.right-section {
    flex: 1;
    max-width: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.app-title {
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    color: #f8fafc;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
    margin-bottom: 0.3rem;
}

.datetime-display {
    text-align: center;
    margin-bottom: 1.2rem;
    width: 100%;
}

.date-line {
    display: flex;
    justify-content: center;
    gap: 1rem;
    align-items: baseline;
    margin-bottom: 0.3rem;
}

.date {
    font-size: 2.5rem;
    color: #94a3b8;
    letter-spacing: 0.05em;
    font-weight: 200;
}

.weekday {
    font-size: 1.8rem;
    color: #94a3b8;
    font-weight: 300;
    position: relative;
    top: -0.2em;
}

.weekday.sat {
    color: #60a5fa;
}

.weekday.sun {
    color: #f87171;
}

.time {
    font-size: 8rem;
    font-weight: 200;
    line-height: 1;
    background: linear-gradient(to bottom right, #ffffff, #cbd5e1);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px var(--accent-glow);
    font-variant-numeric: tabular-nums;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    justify-content: center;
    width: 100%;
}

.btn-large {
    width: 140px;
    flex: 0 0 auto;
    font-size: 1.2rem;
    padding: 0.9rem 0.8rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    color: #0f172a;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-large:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.btn-large:active {
    transform: translateY(1px);
}

.btn-in {
    background: linear-gradient(135deg, #86efac, #4ade80);
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.3);
}

.btn-out {
    background: linear-gradient(135deg, #fca5a5, #f87171);
    box-shadow: 0 0 20px rgba(248, 113, 113, 0.3);
}

.btn-request {
    background: var(--req-color);
    box-shadow: 0 5px 15px rgba(250, 204, 21, 0.3);
}

.btn-disabled {
    background: #64748b !important;
    box-shadow: 0 5px 15px rgba(100, 116, 139, 0.3) !important;
    cursor: not-allowed;
}

/* Active/Inactive States */
.btn-inactive {
    opacity: 0.4;
    transform: scale(0.95);
    filter: grayscale(0.8);
}

.btn-active {
    transform: scale(1.05);
    filter: brightness(1.1);
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.3);
    border: 3px solid rgba(255, 255, 255, 0.8);
    z-index: 10;
}

.qr-wrapper {
    width: 200px;
    height: 200px;
    background: white;
    padding: 10px;
    border-radius: 16px;
    border: 2px solid #cbd5e1;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    margin-bottom: 0.8rem;
}

#qrDisplay {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#qrDisplay img,
#qrDisplay canvas {
    max-width: 100%;
    max-height: 100%;
    width: auto !important;
    height: auto !important;
}

.instruction-sub {
    color: #94a3b8;
    font-size: 0.75rem;
    text-align: center;
    white-space: nowrap;
    line-height: 1.3;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 100;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 2.5rem;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
}

.modal h2 {
    margin-bottom: 1rem;
    font-weight: 600;
}

.modal-type-badge {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 0;
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: #0f172a;
}

.modal-type-badge.in {
    background: #4ade80;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

button {
    flex: 1;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.1s, opacity 0.2s;
}

button:active {
    transform: scale(0.95);
}

.btn-submit {
    background: var(--accent-color);
    color: #0f172a;
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: #94a3b8;
}

/* Iframe Modal */
.iframe-modal-container {
    width: 90%;
    max-width: 500px;
    height: 500px;
    background: transparent;
}

.btn-large:active {
    transform: translateY(1px);
}

.btn-in {
    background: linear-gradient(135deg, #86efac, #4ade80);
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.3);
}

.btn-out {
    background: linear-gradient(135deg, #fca5a5, #f87171);
    box-shadow: 0 0 20px rgba(248, 113, 113, 0.3);
}

.btn-request {
    background: var(--req-color);
    box-shadow: 0 5px 15px rgba(250, 204, 21, 0.3);
}

.btn-disabled {
    background: #64748b !important;
    box-shadow: 0 5px 15px rgba(100, 116, 139, 0.3) !important;
    cursor: not-allowed;
}

/* Active/Inactive States */
.btn-inactive {
    opacity: 0.4;
    transform: scale(0.95);
    filter: grayscale(0.8);
}

.btn-active {
    transform: scale(1.05);
    filter: brightness(1.1);
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.3);
    border: 3px solid rgba(255, 255, 255, 0.8);
    z-index: 10;
}

.qr-wrapper {
    width: 200px;
    height: 200px;
    background: white;
    padding: 10px;
    border-radius: 16px;
    border: 2px solid #cbd5e1;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    margin-bottom: 0.8rem;
}

#qrDisplay {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#qrDisplay img,
#qrDisplay canvas {
    max-width: 100%;
    max-height: 100%;
    width: auto !important;
    height: auto !important;
}

.instruction-sub {
    color: #94a3b8;
    font-size: 0.75rem;
    text-align: center;
    white-space: nowrap;
    line-height: 1.3;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 100;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 2.5rem;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
}

.modal h2 {
    margin-bottom: 1rem;
    font-weight: 600;
}

.modal-type-badge {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 0;
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: #0f172a;
}

.modal-type-badge.in {
    background: #4ade80;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

button {
    flex: 1;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.1s, opacity 0.2s;
}

button:active {
    transform: scale(0.95);
}

.btn-submit {
    background: var(--accent-color);
    color: #0f172a;
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: #94a3b8;
}

/* Iframe Modal */
.iframe-modal-container {
    width: 90%;
    max-width: 500px;
    height: 500px;
    background: transparent;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .iframe-modal-container {
    transform: translateY(0);
}

iframe {
    width: 100%;
    height: 100%;
    border-radius: 16px;
    background: transparent;
}

.btn-close-modal {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #f87171;
    color: white;
    font-size: 1.5rem;
    line-height: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 10;
    border: none;
    cursor: pointer;
}

.btn-close-modal:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Notification */
.notification {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 1rem 2rem;
    border-radius: 50px;
    color: var(--text-color);
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 200;
}

.notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.notification.success {
    border-color: #4ade80;
    color: #4ade80;
}

.notification.error {
    border-color: #f87171;
    color: #f87171;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-type-badge.out {
    background: #f87171;
}