/* BBVA SKL WebSocket Interface Styles - Android Layout Match */

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

/* Login Overlay Styles */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #072146 0%, #1a4b8c 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.login-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    width: 400px;
    max-width: 90vw;
    overflow: hidden;
}

.login-header {
    background: #072146;
    color: white;
    text-align: center;
    padding: 30px 20px 20px;
}

.login-logo {
    max-width: 120px;
    height: auto;
    margin-bottom: 15px;
}

.login-header h2 {
    font-size: 18px;
    font-weight: 500;
    margin: 0;
}

.login-form {
    padding: 30px;
}

.login-form .input-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #072146;
    font-size: 14px;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
    outline: none;
    border-color: #072146;
}

.login-options {
    margin-bottom: 25px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #666;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
}

.login-btn {
    width: 100%;
    background: #072146;
    color: white;
    border: none;
    padding: 14px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.login-btn:hover {
    background: #0a2a5a;
}

.login-btn:active {
    background: #051933;
}

.login-error {
    margin-top: 15px;
    padding: 10px;
    background: #ffe6e6;
    border: 1px solid #ff9999;
    border-radius: 4px;
    color: #cc0000;
    font-size: 14px;
    text-align: center;
}

.login-footer {
    background: #f5f5f5;
    text-align: center;
    padding: 15px;
    color: #666;
    font-size: 12px;
}

body {
    font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* Header Section - Matching Android Layout */
header {
    background: #072146;
    color: white;
    text-align: center;
}

.bbva-header {
    background: #072146;
    padding: 40px 40px 0 40px;
    margin-bottom: -20px;
    position: relative;
}

.user-info {
    position: absolute;
    top: 15px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

#currentUser {
    color: white;
    font-size: 14px;
    font-weight: 500;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 15px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.bbva-logo {
    max-width: 200px;
    height: auto;
}

.skl-title {
    background: #072146;
    padding: 20px 0 30px 0;
}

.skl-title h1 {
    font-size: 40px;
    font-weight: normal;
    color: white;
    margin: 0;
}

/* WebSocket Configuration Section */
.websocket-section {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.server-url-input {
    display: none;
}

.server-url-input label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #666;
    font-size: 14px;
}

.server-url-field {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    background: white;
    margin-bottom: 10px;
}

.server-url-field:focus {
    outline: none;
    border-color: #072146;
}

.session-id-input {
    margin-bottom: 15px;
}

.session-id-input label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #072146;
    font-size: 14px;
}

.session-id-field {
    width: 100%;
    padding: 12px;
    border: 2px solid #ccc;
    border-radius: 4px;
    font-size: 18px;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
    background: white;
    margin-bottom: 8px;
}

.session-id-field:focus {
    outline: none;
    border-color: #072146;
}

.session-id-field.valid {
    border-color: #28a745;
    background-color: #f8fff9;
}

.session-id-field.invalid {
    border-color: #dc3545;
    background-color: #fff8f8;
}

.session-id-field.error {
    border-color: #dc3545;
    background-color: #ffe6e6;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.session-status {
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 5px;
}

.session-status.valid {
    color: #28a745;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
}

.session-status.invalid {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
}

.websocket-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.websocket-controls .btn {
    flex: 1;
}

.connection-status {
    text-align: center;
    font-size: 16px;
    color: #000;
    margin-bottom: 20px;
}

/* Key Input Section */
.key-input-section {
    padding: 20px;
}

.key-input-section h2 {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #333;
}

.key-form {
    margin-bottom: 20px;
}

.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #666;
    font-size: 14px;
}

.input-with-toggle {
    position: relative;
    display: flex;
    align-items: center;
}

.hex-input {
    width: 100%;
    padding: 12px 80px 12px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    background: white;
}

.hex-input:focus {
    outline: none;
    border-color: #072146;
}

.password-toggle {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: #666;
    padding: 5px 8px;
    border-radius: 3px;
    min-width: 60px;
}

.password-toggle:hover {
    color: #072146;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    width: 100%;
    margin-bottom: 10px;
    text-transform: uppercase;
}

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

.btn-primary {
    background: #072146;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #0a2a5c;
}

.btn-primary-accent {
    background: #072146;
    color: white;
    margin-top: 20px;
}

.btn-primary-accent:hover:not(:disabled) {
    background: #0a2a5c;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #545b62;
}

.btn-small {
    background: #6c757d;
    color: white;
    padding: 8px 16px;
    font-size: 12px;
    width: auto;
}

/* KCV Display */
.kcv-display {
    text-align: center;
    color: #072146;
    font-size: 20px;
    font-weight: bold;
    margin-top: 10px;
    min-height: 24px;
    font-family: 'Courier New', monospace;
    visibility: hidden;
}

.kcv-display.visible {
    visibility: visible;
}

.master-key-section {
    margin-top: 30px;
    text-align: center;
}

/* Message Log */
.message-log {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.message-log h3 {
    margin-bottom: 15px;
    color: #495057;
    font-size: 16px;
}

.log-content {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    height: 200px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 15px;
}

.log-entry {
    margin-bottom: 8px;
    padding: 5px;
    border-radius: 3px;
}

.log-entry.info {
    background: #d4edda;
    color: #155724;
}

.log-entry.error {
    background: #f8d7da;
    color: #721c24;
}

.log-entry.sent {
    background: #cce7ff;
    color: #004085;
}

.log-entry.kcv {
    background: #d1ecf1;
    color: #0c5460;
    font-weight: bold;
}

/* Footer */
footer {
    padding: 20px;
    text-align: center;
    background: #f8f9fa;
    color: #6c757d;
    font-size: 12px;
    border-top: 1px solid #e0e0e0;
}

footer p {
    margin: 5px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        margin: 0;
        box-shadow: none;
    }
    
    .bbva-header {
        padding: 20px 20px 0 20px;
    }
    
    .bbva-logo {
        max-width: 150px;
    }
    
    .skl-title h1 {
        font-size: 32px;
    }
    
    .websocket-section,
    .key-input-section,
    .message-log {
        padding: 15px;
    }
    
    .websocket-controls {
        flex-direction: column;
        gap: 5px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .hex-input {
        font-size: 14px;
    }
    
    .log-content {
        height: 150px;
        font-size: 11px;
    }
}

/* Input validation styles */
.hex-input.invalid {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.hex-input.valid {
    border-color: #28a745;
}

/* Connection status colors */
.connection-status.connected {
    color: #28a745;
}

.connection-status.connecting {
    color: #ffc107;
}

.connection-status.disconnected {
    color: #dc3545;
}

.connection-status.error {
    color: #dc3545;
}