:root {
    /* AWS Color Palette */
    --aws-primary: #ff9900;
    --aws-primary-dark: #ec7211;
    --aws-primary-light: #ffac31;
    --aws-primary-glow: rgba(255, 153, 0, 0.4);
    --aws-secondary: #1e88e5;
    --aws-secondary-dark: #1976d2;
    --aws-secondary-light: #42a5f5;
    --aws-secondary-glow: rgba(30, 136, 229, 0.4);

    /* Dark Theme Colors */
    --bg-dark: #0f1b2a;
    --bg-darker: #0a1522;
    --bg-light: #162b45;
    --bg-lighter: #1d3557;
    --text-primary: #f5f5f5;
    --text-secondary: #b0bec5;
    --text-muted: #78909c;
    --border-color: #263b50;
    --success: #4caf50;
    --warning: #ff9800;
    --danger: #f44336;
    --info: #03a9f4;

    /* Other Variables */
    --header-height: 70px;
    --sidebar-width: 320px;
    --border-radius: 6px;
    --transition-speed: 0.3s;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.2), 0 6px 6px rgba(0, 0, 0, 0.25);
    --glow-effect: 0 0 15px var(--aws-primary-glow);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Amazon Ember', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-lighter);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    height: var(--header-height);
    background: linear-gradient(90deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.logo-container {
    display: flex;
    align-items: center;
}

.aws-logo {
    color: var(--aws-primary);
    font-size: 28px;
    margin-right: 12px;
    filter: drop-shadow(0 0 8px var(--aws-primary-glow));
}

.header-text h1 {
    font-size: 1.6rem;
    font-weight: 600;
}

.header-text p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-darker);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Main Panel */
.main-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Panels */
.panel {
    background-color: var(--bg-light);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: box-shadow var(--transition-speed);
}

.panel:hover {
    box-shadow: var(--shadow-md);
}

.panel-header {
    background-color: var(--bg-lighter);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
    font-size: 1rem;
    font-weight: 500;
}

.panel-body {
    padding: 16px;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    color: var(--text-primary);
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    transition: all var(--transition-speed);
}

.form-control:focus {
    outline: none;
    border-color: var(--aws-primary);
    box-shadow: 0 0 0 2px var(--aws-primary-glow);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2378909c'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
    padding-right: 32px;
}

/* Checkbox */
.checkbox-wrapper {
    display: flex;
    align-items: center;
}

.checkbox-wrapper input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-right: 8px;
    background-color: var(--bg-dark);
    position: relative;
    cursor: pointer;
}

.checkbox-wrapper input[type="checkbox"]:checked {
    background-color: var(--aws-primary);
    border-color: var(--aws-primary);
}

.checkbox-wrapper input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 6px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-wrapper label {
    margin-bottom: 0;
    cursor: pointer;
}

/* Instance Count Container */
.instance-count-container {
    display: flex;
    align-items: center;
}

.instance-count-container .form-control {
    flex: 1;
    text-align: center;
}

.instance-count-controls {
    display: flex;
    margin-left: 10px;
}

.instance-count-controls button {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    transition: all var(--transition-speed);
    cursor: pointer;
    border: none;
    outline: none;
}

.btn i {
    margin-right: 8px;
    font-size: 0.9em;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-icon {
    padding: 6px;
    width: 32px;
    height: 32px;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-primary {
    background-color: var(--aws-primary);
    color: #000;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--aws-primary-light);
    box-shadow: 0 0 10px var(--aws-primary-glow);
}

.btn-secondary {
    background-color: var(--aws-secondary);
    color: white;
}

.btn-secondary:hover, .btn-secondary:focus {
    background-color: var
    (--aws-secondary-light);
        box-shadow: 0 0 10px var(--aws-secondary-glow);
    }

    .btn-outlined {
        background-color: transparent;
        border: 1px solid var(--border-color);
        color: var(--text-primary);
    }

    .btn-outlined:hover, .btn-outlined:focus {
        border-color: var(--aws-primary);
        color: var(--aws-primary);
    }

    .btn:disabled {
        opacity: 0.6;
        cursor: not-allowed;
        pointer-events: none;
    }

    /* Badges */
    .badge {
        display: inline-block;
        padding: 3px 8px;
        font-size: 0.75rem;
        font-weight: 500;
        border-radius: 12px;
        background-color: var(--aws-primary);
        color: #000;
    }

    .badge-secondary {
        background-color: var(--aws-secondary);
        color: white;
    }

    /* Tooltip */
    .tip-tooltip {
        display: inline-flex;
        position: relative;
        margin-left: 6px;
        color: var(--text-muted);
    }

    .tip-tooltip:hover .tooltip-text {
        visibility: visible;
        opacity: 1;
    }

    .tooltip-text {
        visibility: hidden;
        opacity: 0;
        width: 240px;
        background-color: var(--bg-darker);
        color: var(--text-secondary);
        text-align: left;
        border-radius: var(--border-radius);
        padding: 8px 12px;
        position: absolute;
        z-index: 10;
        bottom: 125%;
        left: 50%;
        transform: translateX(-50%);
        box-shadow: var(--shadow-md);
        transition: opacity 0.3s;
        font-size: 0.8rem;
        border: 1px solid var(--border-color);
    }

    .tooltip-text::after {
        content: "";
        position: absolute;
        top: 100%;
        left: 50%;
        margin-left: -5px;
        border-width: 5px;
        border-style: solid;
        border-color: var(--border-color) transparent transparent transparent;
    }

    /* Tabs */
    .tabs {
        display: flex;
        background-color: var(--bg-darker);
        border-bottom: 1px solid var(--border-color);
        overflow-x: auto;
        scrollbar-width: thin;
    }

    .tab-btn {
        display: inline-flex;
        align-items: center;
        padding: 14px 20px;
        color: var(--text-secondary);
        background-color: transparent;
        border: none;
        border-bottom: 2px solid transparent;
        cursor: pointer;
        transition: all var(--transition-speed);
        font-size: 0.9rem;
        white-space: nowrap;
    }

    .tab-btn i {
        margin-right: 8px;
        font-size: 1em;
    }

    .tab-btn:hover {
        color: var(--text-primary);
        background-color: rgba(255, 255, 255, 0.05);
    }

    .tab-btn.active {
        color: var(--aws-primary);
        border-bottom-color: var(--aws-primary);
    }

    /* Tab Content */
    .tab-content {
        flex: 1;
        overflow-y: auto;
        padding: 20px;
    }

    .tab-pane {
        display: none;
    }

    .tab-pane.active {
        display: block;
    }

    /* Status Badge */
    .status-badge {
        display: inline-flex;
        align-items: center;
        padding: 8px 14px;
        border-radius: 24px;
        background-color: var(--bg-darker);
        margin-bottom: 20px;
        border: 1px solid var(--border-color);
    }

    .status-badge i {
        margin-right: 8px;
        font-size: 1.1rem;
    }

    .status-badge.status-green {
        border-color: var(--success);
    }

    .status-badge.status-green i {
        color: var(--success);
    }

    .status-badge.status-yellow {
        border-color: var(--warning);
    }

    .status-badge.status-yellow i {
        color: var(--warning);
    }

    /* Stats Grid */
    .stats-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .stats-section h4 {
        font-size: 0.9rem;
        font-weight: 500;
        color: var(--text-secondary);
        margin-bottom: 12px;
    }

    .stats-item {
        display: flex;
        margin-bottom: 8px;
    }

    .stats-label {
        color: var(--text-muted);
        min-width: 120px;
    }

    .stats-value {
        color: var(--text-primary);
    }

    /* Action Buttons */
    .action-buttons {
        display: flex;
        gap: 12px;
        flex-wrap: wrap;
    }

    /* Progress */
    .deployment-progress-panel {
        border: 1px solid var(--aws-primary);
        box-shadow: 0 0 10px var(--aws-primary-glow);
    }

    .progress-container {
        padding: 20px 0;
    }

    .progress-track {
        height: 4px;
        background-color: var(--bg-darker);
        border-radius: 2px;
        position: relative;
        margin: 0 10px 20px;
    }

    .progress-bar {
        position: absolute;
        height: 100%;
        background-color: var(--aws-primary);
        border-radius: 2px;
        width: 0;
        transition: width 0.5s ease;
    }

    .progress-steps {
        display: flex;
        justify-content: space-between;
        padding: 0 10px;
    }

    .progress-step {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: var(--text-muted);
        position: relative;
        width: 70px;
    }

    .step-icon {
        width: 36px;
        height: 36px;
        background-color: var(--bg-darker);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 8px;
        border: 2px solid var(--border-color);
        transition: all var(--transition-speed);
    }

    .step-label {
        font-size: 0.8rem;
        text-align: center;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .progress-step.active .step-icon {
        border-color: var(--aws-primary);
        color: var(--aws-primary);
        box-shadow: 0 0 8px var(--aws-primary-glow);
    }

    .progress-step.active .step-label {
        color: var(--aws-primary);
    }

    .progress-step.complete .step-icon {
        background-color: var(--aws-primary);
        border-color: var(--aws-primary);
        color: #000;
    }

    /* Logs */
    .logs-container {
        height: 500px;
        overflow-y: auto;
        background-color: var(--bg-darker);
        border-radius: var(--border-radius);
        padding: 12px;
        font-family: monospace;
        font-size: 0.9rem;
    }

    .log-entry {
        margin-bottom: 6px;
        line-height: 1.4;
    }

    .log-time {
        color: var(--text-muted);
        margin-right: 10px;
    }

    /* Architecture Diagram */
    .architecture-diagram {
        padding: 20px;
        background-color: var(--bg-darker);
        border-radius: var(--border-radius);
        margin-bottom: 20px;
        position: relative;
    }

    .aws-vpc {
        border: 2px solid var(--border-color);
        border-radius: var(--border-radius);
        padding: 40px 20px 20px;
        position: relative;
    }

    .vpc-label {
        position: absolute;
        top: -12px;
        left: 20px;
        padding: 4px 10px;
        background-color: var(--bg-darker);
        color: var(--text-secondary);
        font-size: 0.8rem;
        font-weight: 500;
    }

    .internet-gateway {
        position: absolute;
        top: -24px;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .component-icon {
        width: 40px;
        height: 40px;
        background-color: var(--bg-light);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--border-color);
        font-size: 1.2rem;
        color: var(--text-secondary);
    }

    .component-label {
        margin-top: 6px;
        font-size: 0.8rem;
        color: var(--text-muted);
    }

    .load-balancer {
        display: flex;
        align-items: center;
        background-color: var(--bg-light);
        border-radius: var(--border-radius);
        border: 1px solid var(--border-color);
        padding: 10px;
        margin: 20px auto;
        width: fit-content;
    }

    .component-body {
        margin-left: 10px;
    }

    .component-title {
        font-size: 0.9rem;
        font-weight: 500;
    }

    .component-desc {
        font-size: 0.8rem;
        color: var(--text-muted);
    }

    .auto-scaling-group {
        border: 1px dashed var(--border-color);
        border-radius: var(--border-radius);
        padding: 40px 20px 20px;
        position: relative;
        margin-bottom: 20px;
    }

    .asg-header {
        position: absolute;
        top: -12px;
        left: 20px;
        padding: 4px 10px;
        background-color: var(--bg-darker);
        color: var(--text-secondary);
        font-size: 0.8rem;
        font-weight: 500;
        display: flex;
        align-items: center;
    }

    .asg-header i {
        margin-right: 6px;
    }

    .ec2-instances {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 20px;
    }

    .ec2-instance {
        display: flex;
        flex-direction: column;
        align-items: center;
        background-color: var(--bg-light);
        border-radius: var(--border-radius);
        border: 1px solid var(--border-color);
        padding: 12px;
        width: 120px;
    }

    .ec2-icon {
        color: var(--aws-secondary);
        font-size: 1.8rem;
        margin-bottom: 8px;
    }

    .ec2-type {
        font-size: 0.8rem;
        font-weight: 500;
    }

    .ec2-status {
        font-size: 0.75rem;
        color: var(--text-muted);
        display: flex;
        align-items: center;
        margin-top: 6px;
    }

    .ec2-status.running::before {
        content: "";
        display: inline-block;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background-color: var(--success);
        margin-right: 6px;
    }

    .external-resources {
        display: flex;
        align-items: center;
        background-color: var(--bg-light);
        border-radius: var(--border-radius);
        border: 1px solid var(--border-color);
        padding: 10px;
        margin: 20px auto;
        width: fit-content;
    }

    .architecture-info {
        margin-top: 30px;
    }

    .architecture-info h4 {
        margin-bottom: 12px;
        color: var(--text-secondary);
    }

    .info-list {
        list-style: none;
    }

    .info-list li {
        display: flex;
        align-items: flex-start;
        margin-bottom: 10px;
    }

    .info-list li i {
        margin-right: 10px;
        color: var(--text-muted);
        margin-top: 3px;
    }

    /* Modal */
    .modal {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.7);
        z-index: 1000;
        overflow-y: auto;
    }

    .modal-content {
        background-color: var(--bg-light);
        border-radius: var(--border-radius);
        max-width: 800px;
        margin: 80px auto;
        box-shadow: var(--shadow-lg);
        border: 1px solid var(--border-color);
        animation: modal-appear 0.3s ease;
    }

    @keyframes modal-appear {
        from { opacity: 0; transform: translateY(-30px); }
        to { opacity: 1; transform: translateY(0); }
    }

    .modal-header {
        padding: 16px 20px;
        border-bottom: 1px solid var(--border-color);
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .modal-header h2 {
        font-size: 1.3rem;
        font-weight: 500;
    }

    .modal-close {
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--text-muted);
        cursor: pointer;
        transition: color var(--transition-speed);
    }

    .modal-close:hover {
        color: var(--text-primary);
    }

    .modal-body {
        padding: 20px;
        max-height: 70vh;
        overflow-y: auto;
    }

    .modal-footer {
        padding: 16px 20px;
        border-top: 1px solid var(--border-color);
        text-align: right;
    }

    .help-section {
        margin-bottom: 24px;
    }

    .help-section h3 {
        font-size: 1.1rem;
        margin-bottom: 12px;
        color: var(--aws-primary);
    }

    .help-section ul,
    .help-section ol {
        padding-left: 20px;
        margin-bottom: 16px;
    }

    .help-section li {
        margin-bottom: 8px;
    }

    /* Responsive Adjustments */
    @media (max-width: 992px) {
        .main-content {
            flex-direction: column;
        }

        .sidebar {
            width: 100%;
            border-right: none;
            border-bottom: 1px solid var(--border-color);
        }

        .stats-grid {
            grid-template-columns: 1fr;
        }
    }

    @media (max-width: 768px) {
        .action-buttons {
            flex-direction: column;
        }

        .modal-content {
            margin: 40px 20px;
        }
    }

    @media (max-width: 576px) {
        .header {
            flex-direction: column;
            height: auto;
            padding: 10px;
        }

        .header-actions {
            margin-top: 10px;
        }
    }