:root {
    --primary-color: #007acc;
    --primary-hover: #005a9e;
    --danger-color: #e74c3c;
    --danger-hover: #c0392b;
    --success-color: #27ae60;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #e1e8ed;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card, .targets-card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 40px;
    max-width: 450px;
    width: 100%;
    animation: slideUp 0.4s ease-out;
}

.targets-card {
    max-width: 800px;
}

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

.logo {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    text-align: center;
    color: var(--text-color);
    font-size: 28px;
    margin-bottom: 10px;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

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

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

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: #fafafa;
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 204, 0.3);
}

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

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

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

.btn-secondary:hover {
    background: #6c7a7b;
}

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

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-icon {
    padding: 8px;
    background: transparent;
    color: var(--text-color);
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.05);
}

.error-message {
    background: #fee;
    color: var(--danger-color);
    padding: 12px;
    border-radius: 8px;
    margin-top: 16px;
    font-size: 14px;
    border-left: 4px solid var(--danger-color);
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner.large {
    width: 48px;
    height: 48px;
    border-width: 4px;
    border-color: rgba(0, 122, 204, 0.3);
    border-top-color: var(--primary-color);
}

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

/* Targets Card */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.targets-list {
    display: grid;
    gap: 12px;
}

.target-item {
    background: #fafafa;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.target-item:hover {
    border-color: var(--primary-color);
    background: white;
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.target-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-color);
    margin-bottom: 4px;
}

.target-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.target-host {
    font-size: 13px;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

/* RDP Viewer */
.rdp-viewer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #1e1e1e;
    z-index: 1000;
}

.viewer-header {
    background: #2d2d2d;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #3d3d3d;
}

.connection-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-size: 14px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
    animation: pulse 2s ease-in-out infinite;
}

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

.viewer-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.viewer-container {
    position: relative;
    width: 100%;
    height: calc(100% - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1e1e1e;
}

#rdpCanvas {
    max-width: 100%;
    max-height: 100%;
    background: #000;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    color: white;
}

footer {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
    .login-card, .targets-card {
        padding: 30px 20px;
    }

    .header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .viewer-header {
        flex-direction: column;
        gap: 8px;
    }
}
