:root {
    --bg-dark: #121212;
    --card-bg: #1e1e1e;
    --card-border: #333;
    --text-main: #f5f5f5;
    --text-muted: #a0a0a0;
    --primary: #22c55e;
    --primary-glow: rgba(34, 197, 94, 0.3);
    --primary-dark: #16a34a;
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.3);
    --danger-dark: #dc2626;
    --mc-grass-top: #599236;
    --mc-dirt: #79553a;
    --radius: 12px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(18, 18, 18, 0.8), rgba(18, 18, 18, 0.95)),
        url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCI+PHJlY3Qgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIiBmaWxsPSJub25lIi8+PHBhdGggZD0iTTAgMGg0MHY0MEgweiIgZmlsbD0ibm9uZSIvPjxwb2x5Z29uIHBvaW50cz0iMCAwIDIwIDAgMjAgMjAgMCAyMCIgZmlsbD0icmdiYSgyNTUsMjU1LDI1NSwwLjAyKSIvPjxwb2x5Z29uIHBvaW50cz0iMjAgMjAgNDAgMjAgNDAgNDAgMjAgNDAiIGZpbGw9InJnYmEoMjU1LDI1NSwyNTUsMC4wMikiLz48L3N2Zz4=');
    z-index: -1;
}

.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Header */
.app-header {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.header-title {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-mc img {
    width: 48px;
    height: 48px;
    image-rendering: pixelated;
}

.header-title h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    font-family: 'VT323', monospace;
    letter-spacing: 1px;
}

.subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    font-size: 0.9rem;
    font-weight: 600;
}

.pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--text-muted);
    box-shadow: 0 0 8px currentColor;
    transition: var(--transition);
}

.header-badge.online .pulse-dot {
    background-color: var(--primary);
    color: var(--primary);
    animation: pulse 2s infinite;
}

.header-badge.offline .pulse-dot {
    background-color: var(--danger);
    color: var(--danger);
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 12px;
}

.card h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-main);
}

.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

.badge.online {
    background: rgba(34, 197, 94, 0.15);
    color: var(--primary);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge.offline {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Status Details & Cube */
.status-details {
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 10px 0;
}

.status-illustration {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.metrics-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.metric {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.02);
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.metric .label {
    color: var(--text-muted);
}

.metric .value {
    font-weight: 600;
}

/* 3D Cube Animation */
.cube-container {
    width: 60px;
    height: 60px;
    perspective: 400px;
}
.cube {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(-20deg) rotateY(45deg);
    animation: rotateCube 10s infinite linear;
}
@keyframes rotateCube {
    0% { transform: rotateX(-20deg) rotateY(0deg); }
    100% { transform: rotateX(-20deg) rotateY(360deg); }
}

.face {
    position: absolute;
    width: 60px;
    height: 60px;
    background-color: #53ca53;
    box-shadow: inset 0 0 0 2px rgba(0,0,0,0.15);
    /* mask for the build/destroy animation on side faces */
    -webkit-mask-image: linear-gradient(to top, black 50%, transparent 50%);
    mask-image: linear-gradient(to top, black 50%, transparent 50%);
    -webkit-mask-size: 100% 200%;
    mask-size: 100% 200%;
    -webkit-mask-position: 0 0;
    mask-position: 0 0;
    transition: mask-position 1.5s steps(8), -webkit-mask-position 1.5s steps(8);
}

.face.front {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath fill='%23111' d='M1 2h2v2H1zM5 2h2v2H5zM3 4h2v3H3z'/%3E%3Cpath fill='%23111' d='M2 5h1v2H2zM5 5h1v2H5z'/%3E%3C/svg%3E");
    background-size: cover;
    image-rendering: pixelated;
}

.face.top, .face.bottom {
    -webkit-mask-image: none;
    mask-image: none;
    opacity: 0;
    transition: opacity 0s ease 0s;
}

/* Stan ONLINE lub STARTING (w pelni zbudowane / buduje sie) */
.cube-container.online .face, .cube-container.starting .face {
    -webkit-mask-position: 0 100%;
    mask-position: 0 100%;
}
.cube-container.online .face.top, .cube-container.starting .face.top,
.cube-container.online .face.bottom, .cube-container.starting .face.bottom {
    opacity: 1;
    transition: opacity 0s ease 1.5s;
}

.face.front  { transform: rotateY(  0deg) translateZ(30px); }
.face.right  { transform: rotateY( 90deg) translateZ(30px); }
.face.back   { transform: rotateY(180deg) translateZ(30px); }
.face.left   { transform: rotateY(-90deg) translateZ(30px); }
.face.top    { transform: rotateX( 90deg) translateZ(30px); }
.face.bottom { transform: rotateX(-90deg) translateZ(30px); }

/* Buttons */
.action-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.action-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.button-group {
    display: grid;
    gap: 14px;
}

.primary-actions {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.btn {
    padding: 14px 20px;
    border-radius: 8px;
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition);
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-power-on {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 0 var(--primary-dark);
}

.btn-power-on:hover:not(:disabled) {
    background: #25d366;
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--primary-dark);
}

.btn-power-off {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 4px 0 var(--danger-dark);
}

.btn-power-off:hover:not(:disabled) {
    background: #f87171;
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--danger-dark);
}

.advanced-section details {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 10px 14px;
}

.advanced-section summary {
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    user-select: none;
}

.secondary-actions {
    margin-top: 12px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    box-shadow: 0 2px 0 rgba(0,0,0,0.5);
    padding: 10px;
    font-size: 0.85rem;
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 10px;
    font-size: 0.85rem;
}

.btn-danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.2);
}

.btn-logout {
    padding: 8px 14px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--card-border);
    border-radius: 6px;
}

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

/* Console Log */
.log-console {
    background: #000;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 14px;
    font-family: 'VT323', 'Courier New', monospace;
    font-size: 1.1rem;
    height: 120px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-entry {
    color: #a3a3a3;
    line-height: 1.4;
}

.log-entry.info { color: #3b82f6; }
.log-entry.success { color: #22c55e; }
.log-entry.warning { color: #eab308; }
.log-entry.error { color: #ef4444; }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

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

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 400px;
    width: 90%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 8px;
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}
.btn-confirm {
    background: var(--primary);
    color: #000;
}

@media (max-width: 600px) {
    .status-details {
        flex-direction: column;
    }
}

/* Login Page Styles */
.login-body {
    background-color: var(--bg-dark);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    z-index: 10;
}

.login-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 32px;
    gap: 24px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
}

.login-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.88rem;
    color: var(--text-muted);
    font-weight: 600;
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    width: 100%;
    padding: 14px 44px 14px 16px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--card-border);
    color: #fff;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.password-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn-toggle-pwd {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
}

.btn-login {
    width: 100%;
    padding: 16px;
    font-size: 1rem;
    margin-top: 4px;
}

.login-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #f87171;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.88rem;
    text-align: center;
}

.login-footer {
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 24px;
}
