/**
 * AmpPal Main Stylesheet
 * 
 * Modern, responsive design with clean aesthetics
 */

/* Root Variables */
:root {
    --primary-color: #0d6efd;
    --success-color: #4CAF50;
    --warning-color: #FFC107;
    --danger-color: #F44336;
    --info-color: #17a2b8;
    --light-bg: #f8f9fa;
    --dark-bg: #2d2d2d;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

/* Dark Theme Variables */
[data-theme="dark"] {
    --light-bg: #1e1e1e;
    --dark-bg: #121212;
    --text-primary: #e4e4e4;
    --text-secondary: #a0a0a0;
    --border-color: #404040;
}

/* Global Styles */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--light-bg);
}

main {
    flex: 1;
}

/* Navigation */
.navbar {
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

.navbar-brand i {
    font-size: 1.5rem;
    vertical-align: middle;
}

/* Notification Dropdown */
.notification-dropdown {
    min-width: 320px;
    max-height: 400px;
    overflow-y: auto;
}

.notification-dropdown .dropdown-item {
    white-space: normal;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.notification-dropdown .dropdown-item:last-child {
    border-bottom: none;
}

.notification-dropdown .dropdown-item:hover {
    background-color: var(--light-bg);
}

/* Cards */
.card {
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s ease;
}

.card-header {
    background-color: var(--light-bg);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

/* Buttons */
.btn {
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn:active {
    transform: translateY(0);
}

.btn-group-sm > .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table thead th {
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.table tbody tr {
    transition: background-color 0.15s ease;
}

.table-hover tbody tr:hover {
    background-color: var(--light-bg);
}

/* Status Badges */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* Forms */
.form-label {
    font-weight: 500;
    color: var(--text-primary);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Modals */
.modal-header {
    border-bottom: 1px solid var(--border-color);
    background-color: var(--light-bg);
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    background-color: var(--light-bg);
}

/* Alerts */
.alert {
    border-left: 4px solid;
}

.alert-success {
    border-left-color: var(--success-color);
}

.alert-danger {
    border-left-color: var(--danger-color);
}

.alert-warning {
    border-left-color: var(--warning-color);
}

.alert-info {
    border-left-color: var(--info-color);
}

/* Footer */
.footer {
    margin-top: 3rem;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-color);
}

/* Loading Spinner */
.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    max-width: 400px;
    width: 100%;
}

.dev-login,
.oauth-login {
    padding: 1rem 0;
}

/* Session List */
.session-row {
    transition: all 0.2s ease;
}

.session-row:hover {
    background-color: var(--light-bg);
}

/* Status Indicators */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status-dot.running {
    background-color: var(--success-color);
    animation: pulse 2s infinite;
}

.status-dot.stopped {
    background-color: var(--text-secondary);
}

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

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .btn-group-sm > .btn {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }

    .table {
        font-size: 0.875rem;
    }

    .table thead {
        display: none;
    }

    .table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: 0.25rem;
    }

    .table tbody td {
        display: block;
        text-align: right;
        padding: 0.5rem;
        border-bottom: 1px solid var(--border-color);
    }

    .table tbody td:last-child {
        border-bottom: none;
    }

    .table tbody td::before {
        content: attr(data-label);
        float: left;
        font-weight: 600;
        text-transform: uppercase;
        font-size: 0.75rem;
        color: var(--text-secondary);
    }
}

@media (max-width: 576px) {
    .container {
        padding: 0.5rem;
    }

    .card {
        border-radius: 0;
    }

    .notification-dropdown {
        min-width: 280px;
    }
}

/* Accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

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

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Print Styles */
@media print {
    .navbar,
    .footer,
    .btn,
    .modal {
        display: none !important;
    }

    body {
        background: white;
    }

    .card {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* Custom Utilities */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hover-lift {
    transition: transform 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
}

/* Dark Mode Enhancements */
[data-theme="dark"] body {
    background-color: var(--dark-bg);
    color: var(--text-primary);
}

[data-theme="dark"] .card {
    background-color: var(--light-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .table {
    color: var(--text-primary);
}

[data-theme="dark"] .form-control {
    background-color: var(--dark-bg);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .modal-content {
    background-color: var(--light-bg);
    color: var(--text-primary);
}

/* Host Status Indicators */
.status-dot.testing {
    background-color: var(--warning-color);
    animation: pulse 1s infinite;
}

.status-dot.connected {
    background-color: var(--success-color);
}

.status-dot.disconnected {
    background-color: var(--text-secondary);
}

/* GitHub Integration Styles */
.github-repo-item {
    transition: background-color 0.2s ease;
}

.github-repo-item:hover {
    background-color: var(--light-bg);
}

.github-token-input {
    font-family: 'Courier New', monospace;
}

/* Host Management */
.host-row {
    transition: all 0.2s ease;
}

.host-row:hover {
    background-color: var(--light-bg);
}

.host-auth-icon {
    font-size: 1.1rem;
}

/* Modal Size Enhancements */
.modal-lg {
    max-width: 800px;
}

/* GitHub Repository List */
.github-repo-list {
    max-height: 400px;
    overflow-y: auto;
}

.github-repo-list .list-group-item {
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.github-repo-list .list-group-item:hover {
    background-color: var(--light-bg);
    border-left: 3px solid var(--primary-color);
}

/* Selected Repository Badge */
#selectedRepoBadge .badge {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
}

/* Host Selection Dropdown */
#hostSelect {
    max-width: 100%;
}

/* Enhanced Form Sections */
.form-section {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    margin-bottom: 1rem;
}

.form-section-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

/* Connection Test Feedback */
.connection-test-success {
    color: var(--success-color);
    font-weight: 500;
}

.connection-test-error {
    color: var(--danger-color);
    font-weight: 500;
}

/* Monospace Textarea for SSH Keys */
.font-monospace {
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 0.875rem;
}

/* Loading Indicators */
.loading-overlay {
    position: relative;
}

.loading-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Enhanced Button Groups */
.btn-group-sm .btn {
    font-size: 0.875rem;
}

.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;
}

.btn-group .btn:last-child {
    border-top-right-radius: 0.25rem;
    border-bottom-right-radius: 0.25rem;
}
