/* USAA Controller Connection - Professional Styling */
/* Following USAA Style Guide v1.0 */

/* USAA Apps Menu */
.apps-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #0A3161 0%, #001f3f 100%);
    border-bottom: 2px solid #B31942;
    padding: 8px 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.apps-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 24px;
}

.apps-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.apps-logo:hover {
    transform: scale(1.02);
}

.logo-img {
    height: 40px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.logo-text {
    color: #FFFFFF;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 0.5px;
}

.apps-nav {
    display: flex;
    gap: 16px;
    margin-left: auto;
}

.apps-nav a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.apps-nav a:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.apps-nav a.current {
    color: #FFFFFF;
    background: rgba(179, 25, 66, 0.3);
    font-weight: 600;
}

/* Main Content Styling */

:root {
    /* USAA Brand Colors */
    --primary-color: #0A3161;
    --primary-hover: #0d4080;
    --accent-color: #B31942;
    --accent-hover: #8f1435;
    --secondary-color: #6c757d;

    /* Utility Colors */
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;

    /* Neutral Colors */
    --background-color: #f5f7fa;
    --background-gradient: linear-gradient(135deg, #ffffff 0%, #f5f7fa 50%, #e8ecf1 100%);
    --card-background: #ffffff;
    --text-primary: #000000;
    --text-secondary: #495057;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --border-focus: #0A3161;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(10, 49, 97, 0.2);
    --shadow-lg: 0 10px 40px rgba(10, 49, 97, 0.15);

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
}

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

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--background-gradient);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
    padding-top: 60px;
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(10, 49, 97, 0.1);
}

/* Header Styling */
.header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem;
    background: linear-gradient(135deg, #0A3161 0%, #001f3f 100%);
    border-radius: var(--radius-lg);
    border-bottom: 2px solid var(--accent-color);
}

.title {
    font-size: 1.8em;
    font-weight: 600;
    color: #FFFFFF;
    margin-bottom: 10px;
    letter-spacing: normal;
    line-height: 1.3;
}

.subtitle {
    font-size: 1em;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 300;
    line-height: 1.6;
}

/* Main Content */
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

@media (min-width: 768px) {
    .main-content {
        grid-template-columns: 2fr 1fr;
    }
}

/* Connection Toggle Card */
.connection-toggle-card {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.toggle-header {
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.connection-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--primary-color);
    transition: all 0.3s ease;
}

.status-dot.online {
    background-color: var(--success-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.status-dot.offline {
    background-color: var(--error-color);
}

.connection-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.disconnect-section {
    padding: 2rem;
}

.disconnect-section h3 {
    font-size: 1.25em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.disconnect-section p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.disconnect-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.disconnect-inputs {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.disconnect-inputs .form-input {
    flex: 1;
    margin-bottom: 0;
}

.disconnect-help {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.toggle-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.toggle-btn, .disconnect-btn {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    position: relative;
    white-space: nowrap;
}

.toggle-btn {
    background: var(--primary-color);
    color: white;
}

.toggle-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.disconnect-btn {
    background: var(--accent-color);
    color: white;
}

.disconnect-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

/* Connection Card */
.connection-card {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.card-header {
    padding: 2rem 2rem 1rem;
    border-bottom: 2px solid var(--accent-color);
}

.card-header h2 {
    font-size: 1.5em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.card-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Form Styling */
.connection-form {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 5px;
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--card-background);
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(10, 49, 97, 0.1);
}

.form-input:invalid:not(:placeholder-shown) {
    border-color: var(--error-color);
}

.form-input:valid {
    border-color: var(--success-color);
}

.input-help {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    flex: 1;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-loader {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

.btn-primary.loading .btn-text {
    opacity: 0.7;
}

.btn-primary.loading .btn-loader {
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Status Section */
.status-section {
    padding: 0 2rem 2rem;
}

.status-message {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    display: none;
}

.status-message.success {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
    display: block;
}

.status-message.error {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    display: block;
}

.connection-status {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Info Section */
.info-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.info-card {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.info-card h3 {
    font-size: 1.25em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.requirements-list {
    list-style: none;
    padding: 0;
}

.requirements-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: var(--text-secondary);
    position: relative;
    padding-left: 1.5rem;
}

.requirements-list li:last-child {
    border-bottom: none;
}

.requirements-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: 600;
}

.network-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.status-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.status-value {
    color: var(--text-primary);
    font-weight: 600;
}

.status-value-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.refresh-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.refresh-btn:hover {
    background-color: var(--background-color);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.refresh-btn:active {
    transform: scale(0.95);
}

.refresh-btn.spinning svg {
    animation: spin 1s linear infinite;
}

.status-value.online {
    color: var(--success-color);
}

.status-value.offline {
    color: var(--error-color);
}

/* Footer */
.footer {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer p {
    margin-bottom: 0.5rem;
}

.api-info a {
    color: var(--primary-color);
    text-decoration: none;
}

.api-info a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .connection-form {
        padding: 1.5rem;
    }
    
    .card-header {
        padding: 1.5rem 1.5rem 1rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
    }
    
    .toggle-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .connection-indicator {
        justify-content: center;
    }
    
    .disconnect-inputs {
        flex-direction: column;
    }
    
    .disconnect-btn {
        width: 100%;
    }
}

/* Accessibility - Focus States */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}