/* Inter Font - Modern sans-serif for body content */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

/* JetBrains Mono Font - Modern monospace for logs */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

/* Space Grotesk Font Face Definitions */
@font-face {
    font-family: 'Space Grotesk';
    src: url('fonts/spacegrotesk/SpaceGrotesk-Regular.woff2') format('woff2'),
         url('fonts/spacegrotesk/SpaceGrotesk-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Space Grotesk';
    src: url('fonts/spacegrotesk/SpaceGrotesk-Medium.woff2') format('woff2'),
         url('fonts/spacegrotesk/SpaceGrotesk-Medium.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Space Grotesk';
    src: url('fonts/spacegrotesk/SpaceGrotesk-SemiBold.woff2') format('woff2'),
         url('fonts/spacegrotesk/SpaceGrotesk-SemiBold.otf') format('opentype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Space Grotesk';
    src: url('fonts/spacegrotesk/SpaceGrotesk-Bold.woff2') format('woff2'),
         url('fonts/spacegrotesk/SpaceGrotesk-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* Base Styles */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    font-size: 15px;
}

/* Responsive viewport */
* {
    box-sizing: border-box;
}

/* Loading Spinner */
.auth-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #f4f4f4;
}

.auth-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #BF01A7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Main Content */
.main-content {
    display: none;
}

/* Header */
header {
    background-color: #BF01A7;
    color: white;
    padding: 15px 20px;
    text-align: left;
}

header .title {
    font-family: 'Space Grotesk', Arial, sans-serif;
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.02em;
}

/* Main Container */
main {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Buttons */
button {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    padding: 12px 16px;
    background-color: #BF01A7;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    min-width: 80px;
    white-space: nowrap;
    transition: background-color 0.2s ease;
}

.green-btn {
    background-color: #027e40;
}

.red-btn {
    background-color: #7e0202;
}

.orange-btn {
    background-color: #7e4402;
}

.yellow-btn {
    background-color: #7e7602;
}

button:hover {
    background-color: #8b0186;
}

/* Control Panel Styles */
.control-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.control-group {
    border: 2px solid #BF01A7;
    border-radius: 12px;
    padding: 20px;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.control-group h3 {
    font-family: 'Space Grotesk', Arial, sans-serif;
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    letter-spacing: -0.01em;
}

.control-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.control-buttons button {
    flex: 1;
    min-width: 100px;
}

/* Log section */
.log-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.log-section h3 {
    font-family: 'Space Grotesk', Arial, sans-serif;
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    letter-spacing: -0.01em;
}

#log {
    font-family: 'JetBrains Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
    white-space: pre-wrap;
    border: 1px solid #BF01A7;
    border-radius: 10px;
    padding: 10px;
    background-color: #f9f9f9;
    height: 400px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 400;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    border-radius: 10px;
    width: 400px;
    max-width: 90%;
}

/* Network Simulation Modal - Top aligned and scrollable */
#networkSimModal .modal-content {
    margin: 20px auto;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    width: 500px;
    max-width: 95%;
    padding: 0;
}

#networkSimModal .modal-header {
    position: sticky;
    top: 0;
    background-color: #fefefe;
    padding: 20px 20px 10px 20px;
    border-bottom: 1px solid #e1e1e1;
    z-index: 1;
}

#networkSimModal .modal-content form {
    padding: 0 20px 20px 20px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-family: 'Space Grotesk', Arial, sans-serif;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.01em;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    box-sizing: border-box;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* Login Page Styles */
.login-container {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    width: 100%;
}

.login-title {
    font-family: 'Space Grotesk', Arial, sans-serif;
    text-align: center;
    color: #BF01A7;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 30px;
    letter-spacing: -0.02em;
}

/* Login page specific body styling */
body.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-weight: bold;
}

input[type="text"], input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    box-sizing: border-box;
}

input[type="text"]:focus, input[type="password"]:focus {
    outline: none;
    border-color: #BF01A7;
    box-shadow: 0 0 5px rgba(191, 1, 167, 0.3);
}

.login-button {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    width: 100%;
    padding: 12px;
    background-color: #BF01A7;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
}

.login-button:hover {
    background-color: #8b0186;
}

.error-message {
    color: #d32f2f;
    font-size: 14px;
    margin-top: 10px;
    text-align: center;
}


/* Responsive Design */
@media (max-width: 768px) {
    main {
        padding: 15px;
    }
    
    header {
        padding: 15px;
    }
    
    header .title {
        font-size: 20px;
    }
    
    .control-panel {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .control-group {
        padding: 15px;
    }
    
    .control-group h3 {
        font-size: 15px;
        margin-bottom: 12px;
    }
    
    .control-buttons {
        gap: 8px;
    }
    
    .control-buttons button {
        min-width: 90px;
        font-size: 13px;
        padding: 10px 12px;
    }
    
    .log-section {
        padding: 15px;
    }
    
    .log-section h3 {
        font-size: 16px;
    }
    
    #log {
        height: 300px;
        font-size: 12px;
    }
    
    .modal-content {
        margin: 5% auto;
        width: 95%;
        max-width: 400px;
    }
}

@media (max-width: 480px) {
    main {
        padding: 10px;
    }
    
    header {
        padding: 12px;
    }
    
    header .title {
        font-size: 18px;
    }
    
    .control-panel {
        gap: 12px;
        margin-bottom: 15px;
    }
    
    .control-group {
        padding: 12px;
    }
    
    .control-group h3 {
        font-size: 14px;
        margin-bottom: 10px;
    }
    
    .control-buttons {
        gap: 6px;
    }
    
    .control-buttons button {
        min-width: 70px;
        font-size: 12px;
        padding: 8px 10px;
        flex: 1 1 calc(50% - 3px);
    }
    
    .log-section {
        padding: 12px;
    }
    
    .log-section h3 {
        font-size: 15px;
    }
    
    #log {
        height: 250px;
        font-size: 11px;
        padding: 8px;
    }
    
    .modal-content {
        margin: 2% auto;
        width: 98%;
        padding: 15px;
    }
    
    .modal-header h3 {
        font-size: 16px;
    }
    
    .form-group input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .login-container {
        padding: 30px 20px;
        margin: 20px;
    }
    
    .login-title {
        font-size: 20px;
    }
}

/* Network Simulation Specific Styles */
.status-indicator {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
}

.network-sim-details {
    margin-top: 8px;
    padding: 6px 8px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    font-family: 'JetBrains Mono', monospace;
}

.network-sim-details small {
    color: #495057;
    font-size: 11px;
}

.form-section {
    margin-bottom: 24px;
    padding: 16px;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    background-color: #fafafa;
}

.form-section h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.scenario-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.scenario-btn {
    padding: 8px 12px;
    border: 1px solid #007acc;
    background-color: #f0f8ff;
    color: #007acc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    flex: 1 1 calc(50% - 4px);
    min-width: 100px;
}

.scenario-btn:hover {
    background-color: #007acc;
    color: white;
}

.scenario-btn:active {
    transform: translateY(1px);
}

.input-help {
    font-size: 11px;
    color: #666;
    margin-left: 8px;
}

.status-display {
    background-color: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.status-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
}

.status-item:last-child {
    margin-bottom: 0;
}

.status-label {
    font-weight: 500;
    color: #495057;
}

.status-value {
    color: #007acc;
    font-weight: 600;
}

/* Mobile responsiveness for network simulation */
@media (max-width: 600px) {
    .scenario-buttons {
        flex-direction: column;
    }
    
    .scenario-btn {
        flex: 1 1 auto;
        min-width: auto;
    }
    
    .form-section {
        padding: 12px;
        margin-bottom: 16px;
    }
    
    .status-item {
        flex-direction: column;
        gap: 4px;
    }
    
    /* Network simulation modal mobile adjustments */
    #networkSimModal .modal-content {
        margin: 10px auto;
        max-height: calc(100vh - 20px);
        width: 95%;
    }
    
    #networkSimModal .modal-header {
        padding: 15px 15px 10px 15px;
    }
    
    #networkSimModal .modal-content form {
        padding: 0 15px 15px 15px;
    }
}