/* ==========================================================================
   Render Monitor Dashboard - Mobile-First Responsive CSS
   Consolidated styles for all pages: admin, operator, and index
   ========================================================================== */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #0a0a0a;
    color: #e0e0e0;
    line-height: 1.6;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* Container - Mobile First */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
}

/* Header - Mobile First */
header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 20px 0;
    margin-bottom: 20px;
    border-radius: 10px;
    text-align: center;
}

h1 {
    font-size: 1.8em;
    color: #4fbdba;
    margin-bottom: 10px;
    word-break: break-word;
}

.subtitle {
    color: #7ec8e3;
    font-size: 1em;
    margin-bottom: 15px;
}

.description {
    color: #a0a0a0;
    font-size: 0.9em;
    max-width: 100%;
    margin: 0 auto;
}

.operator-id {
    color: #a0a0a0;
    font-size: 0.8em;
    margin-top: 10px;
    word-break: break-all;
    padding: 0 10px;
}

/* Status Bar - Mobile First Grid */
.status-bar {
    background: #1a1a2e;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.stat-card {
    background: #16213e;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #2a3f5f;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(79, 189, 186, 0.2);
}

.stat-value {
    font-size: 1em;
    font-weight: bold;
    color: #4fbdba;
    margin-bottom: 5px;
}

.stat-label {
    color: #7ec8e3;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    word-break: break-word;
}

/* Operator Section - Mobile First */
.operator-section {
    margin-bottom: 30px;
    border: 2px solid #2a2a2a;
    border-radius: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
}

.operator-header {
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(79, 189, 186, 0.1);
    border-radius: 10px;
    border-left: 4px solid #4fbdba;
}

.operator-title {
    font-size: 1.1em;
    color: #4fbdba;
    font-weight: 600;
    margin-bottom: 8px;
    font-family: 'Fira Code', monospace;
    word-break: break-all;
}

.operator-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.9em;
    color: #a0a0a0;
}

.operator-stat {
    display: flex;
    flex-direction: column;
    text-align: center;
    padding: 10px;
    background: rgba(79, 189, 186, 0.05);
    border-radius: 8px;
}

.operator-stat-value {
    color: #7ec8e3;
    font-weight: 600;
    font-size: 1.8em;
}

.operator-stat-label {
    color: #666;
    font-size: 0.7em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Nodes Grid - Mobile First */
.nodes-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.node-card {
    background: #1a1a2e;
    border: 1px solid #2a3f5f;
    border-radius: 10px;
    padding: 15px;
    transition: all 0.3s;
}

.node-card:hover {
    border-color: #4fbdba;
    box-shadow: 0 5px 20px rgba(79, 189, 186, 0.3);
}

.node-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #2a3f5f;
}

.node-name {
    font-size: 1.1em;
    color: #4fbdba;
    font-weight: 600;
    word-break: break-all;
    text-align: center;
}

.node-status {
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 500;
    text-align: center;
    align-self: center;
    white-space: nowrap;
}

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

.status-offline {
    background: #ef4444;
    color: white;
}

.status-rendering {
    background: #ef4444;
    color: white;
    animation: pulse-render 2s infinite;
}

@keyframes pulse-render {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Node Stats - Mobile First */
.node-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.node-stat {
    background: #16213e;
    padding: 8px;
    border-radius: 6px;
    text-align: center;
}

.node-stat-value {
    font-size: 1.2em;
    color: #7ec8e3;
    font-weight: 600;
    word-break: break-all;
}

.node-stat-label {
    font-size: 0.7em;
    color: #94a3b8;
    margin-top: 2px;
}

.last-seen {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #2a3f5f;
    text-align: center;
    color: #94a3b8;
    font-size: 0.8em;
}

.current-job {
    margin-top: 15px;
    padding: 10px;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 8px;
    border-left: 3px solid #f59e0b;
    font-size: 0.9em;
}

.node-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #2a3f5f;
}

.screenshot-btn {
    background: #4fbdba;
    color: #0a0a0a;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.screenshot-btn:hover:not(:disabled) {
    background: #7ec8e3;
    transform: translateY(-1px);
}

.screenshot-btn:disabled {
    background: #444;
    color: #888;
    cursor: not-allowed;
}

/* Connection Status - Mobile First */
.connection-status {
    position: fixed;
    top: 10px;
    right: 10px;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 0.8em;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.status-disconnected, .disconnected {
    background: #ef4444;
    color: white;
}

.pulse {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

/* Epoch Navigation - Mobile First */
.epoch-navigation {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.epoch-nav-btn {
    background: #2a3f5f;
    color: #7ec8e3;
    border: 1px solid #4fbdba;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    width: 120px;
}

.epoch-nav-btn:hover:not(:disabled) {
    background: #3a4f6f;
    transform: scale(1.05);
}

.epoch-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.epoch-nav-btn:disabled:hover {
    transform: none;
}

/* Modals - Mobile First */
.rename-modal, .login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-overlay {
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
}

.rename-modal-content, .login-container {
    background: #1a1a2e;
    border-radius: 15px;
    padding: 20px;
    max-width: 400px;
    width: 100%;
    border: 2px solid #4fbdba;
}

.login-container {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    box-shadow: 0 10px 30px rgba(79, 189, 186, 0.3);
    text-align: center;
    min-width: auto;
}

.rename-modal h3, .login-title {
    color: #4fbdba;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.5em;
    font-weight: 600;
}

.login-subtitle {
    color: #7ec8e3;
    margin-bottom: 20px;
    font-size: 1em;
}

.rename-form, .login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.rename-input, .login-input {
    background: #16213e;
    border: 1px solid #2a3f5f;
    border-radius: 8px;
    padding: 12px;
    color: #e0e0e0;
    font-size: 16px;
    transition: border-color 0.3s;
}

.login-input {
    background: #0a0a0a;
    border: 2px solid #2a3f5f;
}

.rename-input:focus, .login-input:focus {
    outline: none;
    border-color: #4fbdba;
}

.login-input:focus {
    box-shadow: 0 0 10px rgba(79, 189, 186, 0.3);
}

.rename-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-direction: column;
}

.rename-btn, .login-button {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1em;
}

.rename-btn-save, .login-button {
    background: #4fbdba;
    color: #0a0a0a;
}

.rename-btn-save:hover, .login-button:hover {
    background: #3da3a0;
    transform: translateY(-1px);
}

.rename-btn-cancel {
    background: #ef4444;
    color: white;
}

.rename-btn-cancel:hover {
    background: #f87171;
}

.login-error {
    color: #ef4444;
    margin-top: 10px;
    display: none;
}

.dashboard-container {
    display: none;
}

/* Index Page Specific Styles */
.download-section {
    background: #1a1a2e;
    padding: 30px 15px;
    border-radius: 10px;
    margin-bottom: 30px;
    border: 1px solid #2a3f5f;
    text-align: center;
}

.download-card {
    background: #16213e;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #2a3f5f;
    max-width: 100%;
    margin: 0 auto;
    transition: transform 0.2s, box-shadow 0.2s;
}

.download-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(79, 189, 186, 0.2);
}

.download-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.download-title {
    font-size: 1.4em;
    color: #4fbdba;
    margin-bottom: 15px;
}

.download-description {
    color: #7ec8e3;
    margin-bottom: 20px;
    font-size: 1em;
}

.download-button {
    display: inline-block;
    background: #4fbdba;
    color: #0a0a0a;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1em;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
}

.download-button:hover {
    background: #7ec8e3;
    transform: translateY(-2px);
}

.features {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 20px;
    text-align: left;
}

.feature {
    background: #0f1a2a;
    padding: 12px;
    border-radius: 5px;
    font-size: 0.9em;
}

.feature-icon {
    color: #4fbdba;
    margin-right: 8px;
}

.instructions {
    background: #1a1a2e;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #2a3f5f;
}

.step {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    padding: 15px;
    background: #16213e;
    border-radius: 8px;
    flex-direction: column;
    text-align: center;
}

.step-number {
    background: #4fbdba;
    color: #0a0a0a;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-bottom: 10px;
    flex-shrink: 0;
    align-self: center;
}

.step-content h3 {
    color: #4fbdba;
    margin-bottom: 5px;
}

.code {
    background: #0a0a0a;
    padding: 10px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    margin: 10px 0;
    border: 1px solid #2a3f5f;
    word-break: break-all;
    font-size: 0.9em;
}

.warning {
    background: #2d1b1b;
    border: 1px solid #5a2a2a;
    padding: 15px;
    border-radius: 5px;
    margin: 15px 0;
    font-size: 0.9em;
}

.warning-icon {
    color: #ff6b6b;
    margin-right: 10px;
}

.footer-links {
    text-align: center;
    margin-top: 30px;
    padding: 15px;
}

.footer-links a {
    color: #4fbdba;
    text-decoration: none;
    margin: 5px 10px;
    padding: 8px 16px;
    border: 1px solid #4fbdba;
    border-radius: 5px;
    transition: all 0.3s;
    display: inline-block;
    font-size: 0.9em;
}

.footer-links a:hover {
    background: #4fbdba;
    color: #0a0a0a;
}

/* Utility Classes */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: #7ec8e3;
    font-size: 1.1em;
}

.error-message, .error {
    background: #ef4444;
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    text-align: center;
    font-size: 0.9em;
}

.clickable {
    cursor: pointer;
    transition: color 0.2s;
}

.clickable:hover {
    color: #7ec8e3 !important;
}

/* Payout Input Styles */
.operator-payout-input {
    margin: 15px 0;
    padding: 15px;
    background: #16213e;
    border-radius: 8px;
    border: 1px solid #4fbdba;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.operator-payout-input label {
    color: #7ec8e3;
    font-weight: 600;
    font-size: 0.9em;
}

.operator-payout-input-field {
    background: #1a1a2e;
    color: #e0e0e0;
    border: 1px solid #4fbdba;
    padding: 8px 12px;
    border-radius: 5px;
    width: 100%;
    font-size: 16px;
}

.operator-payout-input button {
    background: #4fbdba;
    color: #0a0a0a;
    border: none;
    padding: 10px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.operator-payout-input button:hover {
    background: #7ec8e3;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS - Progressive Enhancement
   ========================================================================== */

/* Small tablets and large phones (576px and up) */
@media (min-width: 576px) {
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 2.2em;
    }
    
    .status-bar {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 15px;
        padding: 20px;
    }
    
    .stat-value {
        font-size: 1.1em;
    }
    
    .node-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .node-name {
        text-align: left;
        margin-right: 15px;
    }
    
    .node-status {
        align-self: auto;
    }
    
    .node-stats {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .operator-stats {
        flex-direction: row;
        justify-content: space-around;
    }
    
    .operator-stat {
        text-align: left;
        min-width: 120px;
    }
    
    .epoch-navigation {
        flex-direction: row;
        gap: 15px;
    }
    
    .epoch-nav-btn {
        width: auto;
    }
    
    .rename-buttons {
        flex-direction: row;
        justify-content: flex-end;
    }
    
    .step {
        flex-direction: row;
        text-align: left;
    }
    
    .step-number {
        margin-bottom: 0;
        margin-right: 15px;
        align-self: flex-start;
    }
    
    .features {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .download-icon {
        font-size: 4em;
    }
    
    .download-title {
        font-size: 1.6em;
    }
    
    .operator-payout-input {
        flex-direction: row;
        align-items: center;
    }
    
    .operator-payout-input label {
        min-width: 180px;
        margin-right: 10px;
    }
    
    .operator-payout-input-field {
        width: 120px;
        margin-right: 10px;
    }
}

/* Medium devices (768px and up) */
@media (min-width: 768px) {
    header {
        padding: 30px 0;
        margin-bottom: 30px;
    }
    
    h1 {
        font-size: 2.5em;
    }
    
    .subtitle {
        font-size: 1.1em;
    }
    
    .status-bar {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 20px;
    }
    
    .nodes-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: 20px;
    }
    
    .operator-section {
        padding: 25px;
    }
    
    .operator-title {
        font-size: 1.4em;
    }
    
    .operator-stat-value {
        font-size: 2.5em;
    }
    
    .connection-status {
        bottom: 20px;
        right: 20px;
        top: auto;
        padding: 10px 20px;
        font-size: 0.9em;
        gap: 10px;
    }
    
    .rename-modal-content, .login-container {
        padding: 30px;
        max-width: 500px;
    }
    
    .login-container {
        min-width: 400px;
    }
    
    .download-section {
        padding: 40px;
    }
    
    .download-card {
        padding: 30px;
        max-width: 500px;
    }
    
    .instructions {
        padding: 30px;
    }
    
    .features {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

/* Large devices (992px and up) */
@media (min-width: 992px) {
    h1 {
        font-size: 3em;
    }
    
    .nodes-grid {
        grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    }
    
    .node-stat-value {
        font-size: 1.5em;
    }
    
    .download-title {
        font-size: 1.8em;
    }
    
    .download-description {
        font-size: 1.1em;
    }
    
    .download-button {
        font-size: 1.2em;
        padding: 15px 30px;
    }
}

/* Extra large devices (1200px and up) */
@media (min-width: 1200px) {
    .nodes-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    }
    
    .container {
        padding: 25px;
    }
}

/* Print styles */
@media print {
    .connection-status,
    .screenshot-btn,
    .epoch-navigation,
    .node-actions {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .node-card,
    .stat-card,
    .operator-section {
        border: 1px solid #ccc;
        background: white;
    }
}