/* --- Global Base --- */
/* Ensure padding doesn't push elements outside their containers */
* {
    box-sizing: border-box;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

body {
    background: radial-gradient(circle at top right, #132033, #5c5858);
    background-attachment: fixed;
    color: white;
    font-family: 'Segoe UI', sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* Prevents horizontal scrolling issues */
}

/* --- Header Layout --- */
header { border-bottom: 1px solid #333; padding-bottom: 20px; }

.top-container { 
    display: flex; 
    flex-direction: column; 
    align-items: flex-start; 
    padding: 20px; 
}


.header-header {
    display: flex;
    justify-content: space-between; /* Pushes status to one side, icon to the other */
    align-items: center;
    width: 100%;
}


.profile-section { display: flex; align-items: center; gap: 20px; }

.status-bar { font-size: 0.8rem; color: #00ff00; margin-bottom: 5px; }

.hamburger-btn { 
    font-size: 24px; 
    background: none; 
    border: none; 
    color: white; 
    cursor: pointer; 
    padding: 5px 0; 
}

.profile-img { 
    width: 80px; 
    height: 80px; 
    border-radius: 50%; 
    object-fit: cover; 
    flex-shrink: 0; 
}

#mySidebar {
    display: none;
    position: fixed; /* Fixed to the viewport */
    top: 0;
    right: 0;         /* This keeps it on the left */
    width: 250px;
    height: 100%;
    padding: 20px;
    z-index: 1000;   /* High enough to stay on top of everything */
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.5);
    overflow-y: auto; /* Adds scroll if content is too long */
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 20px;
}

/* --- Authentication Section --- */
#auth-container {
    text-align: center;
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#auth-container .profile-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-bottom: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* --- Buttons --- */
.menu-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
}

.menu-btn:hover { background: rgba(255, 255, 255, 0.2); }

.btn-affiliate {
    display: block;
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white !important;
    text-decoration: none !important;
    text-align: center;
    font-weight: 600;
}

/* --- Main Content --- */
.project-container { 
    margin-top: 40px; 
    padding: 30px; 
    background: rgba(255, 255, 255, 0.05); 
    backdrop-filter: blur(15px); 
    border-radius: 20px; 
}

.automation-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }

@media (max-width: 600px) { 
    .automation-grid { grid-template-columns: 1fr; } 
    .top-container { text-align: center; align-items: center; }
}

.responsive-wrapper {
    width: 100%;
    overflow: hidden; /* Clips anything overflowing the container */
}

/* Ensure the parent container is the constraint */
.automation-card {
    position: relative;
    overflow: hidden; /* This "clips" any child that tries to break out */
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

/* Force the image/widget to be a fluid child */
.automation-card img, 
.automation-card iframe {
    display: block;
    width: 100%;      /* Child takes 100% of the parent's width */
    height: auto;     /* Maintains aspect ratio */
    max-width: 100%;  /* Ensures it never gets wider than the parent */
    border-radius: 4px;
}

/* Glass Button Base */
.btn, .chat-send-btn {
    display: inline-block;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
}

/* Hover Effect */
.btn:hover, .chat-send-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Active/Click effect */
.btn:active, .chat-send-btn:active {
    transform: translateY(0);
}

/* footer */
/* Ensure the chat is clearly separated */
#chat-section {
    margin-bottom: 50px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Footer Styling */
.site-footer {
    text-align: center;
    padding: 40px 20px;
    background: rgba(0, 0, 0, 0.8);
    color: #aaa;
    font-size: 0.9rem;
    border-top: 1px solid #333;
    margin-top: auto;
}

.footer-content p {
    margin: 5px 0;
}

.social-links a {
    color: #fff;
    text-decoration: none;
    margin: 0 10px;
}

#chat-window {
    height: 300px; /* Larger viewing area */
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
}

textarea#m {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    border: 1px solid #444;
    padding: 10px;
    border-radius: 5px;
    resize: vertical; /* Allows user to drag/resize manually */
    margin-bottom: 10px;
}

.file-upload-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-secondary {
    padding: 8px 15px;
    background: #444;
    cursor: pointer;
    border-radius: 5px;
}