body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    background-color: #ecf0f1; /* Light grey background */
    display: flex;
    min-height: 100vh; /* Use min-height to ensure footer stays at bottom on short content */
    color: #333;
}


.sidebar {
    width: 260px; /* Slightly narrower sidebar */
    background-color: #34495e; /* Darker blue */
    color: #ecf0f1;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    flex-shrink: 0; /* Prevent sidebar from shrinking */
    position: relative; /* Needed for footer */
    z-index: 1; /* Ensure sidebar is above main content if needed */
}

/* --- Main Header Container --- */
.sidebar-header {
    background-color: #2c3e50; /* Keeps your dark header background */
    padding: 12px;
    border-bottom: 1px solid #45627d;
    
    /* Flexbox layout to match the wireframe structure */
    display: flex;
    flex-wrap: wrap; /* Allows items to wrap to a new line */
    gap: 8px;      /* Creates space between all elements */
    align-items: center;
}

/* --- Top Row: Back Button & Title --- */
.back-button {
    background-color: #34495e; /* Use main sidebar color for the "box" effect */
    border-radius: 8px;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* Prevents the button from shrinking */
    color: #ecf0f1; /* Ensure icon color is light */
}

.sidebar h1 {
    flex-grow: 1; /* Allows the title to fill remaining space on the first row */
    background-color: #34495e; /* Use main sidebar color for the "box" effect */
    margin: 0;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 1.2em; /* Adjusted font size */
    font-weight: 600;
    text-align: center;
    color: #ecf0f1; /* Ensure text color is light */
}

/* --- Bottom Row: Generate Button --- */

/* Target the link that contains the generate button */
.sidebar-header a:last-of-type {
    flex-basis: 100%; /* Forces this item to take the full width and move to a new line */
    text-decoration: none;
}

.sidebar button.generate-button {
    width: 100%;
    background-color: #3498db; /* Keep the distinct blue color for the main action button */
    color: white;
    border: none;
    padding: 12px;
    font-size: 1em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.sidebar button.generate-button:hover {
    background-color: #2980b9; /* Darker blue on hover */
    transform: none; /* Removing previous transform effects */
}

/* =================================================== */
/* === REVISED WEBHOOK LIST STYLES (Drop-in Replacement) === */
/* =================================================== */

.webhook-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0;
    margin: 0;
    list-style: none;
    padding-bottom: 60px; /* Space for the footer */
}

/* Make the entire link area a block element */
.webhook-list a {
    display: block;
    text-decoration: none;
}

/* Base style for each item in the list */
.webhook-item {
    padding: 12px 20px;
    border-bottom: 1px solid #45627d;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

/* Hover effect for non-active items */
.webhook-item:not(.active):hover {
    background-color: #3b5165;
}

/* --- FIX 1: Style the Webhook ID (the link text) --- */
.webhook-item h3 {
    margin: 0 0 6px 0;
    font-size: 0.9em;
    font-weight: 600;
    word-break: break-all; /* Break long IDs */
    /* This color matches the light purple in your screenshot for inactive links */
    color: #8e9bff;
    transition: color 0.2s ease;
}

/* Style for the meta text (Created, Messages) */
.webhook-meta {
    margin: 0;
    font-size: 0.8em;
    color: #bdc3c7; /* Light grey for secondary info */
}


/* --- FIX 2: Correctly style the ACTIVE item --- */
.webhook-item.active {
    background-color: #1abc9c; /* The bright green/turquoise */
}

/* This is the key change: Force ALL text within the active item to be white */
.webhook-item.active h3,
.webhook-item.active .webhook-meta {
    color: #ffffff;
}

/* Style for the 'No webhooks yet' message */
.webhook-item.no-webhooks {
    text-align: center;
    color: #bdc3c7;
    padding: 20px;
    cursor: default;
}

.webhook-item.no-webhooks:hover {
    background-color: transparent; /* No hover effect */
}

/* =================================================== */
/* === END OF REPLACEMENT BLOCK === */
/* =================================================== */


.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding-bottom: 60px; /* Add padding for fixed footer */
     position: relative; /* Needed for layout */
}

.header {
    background-color: #fff;
    padding: 15px 20px; /* Added horizontal padding */
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-radius: 8px; /* Rounded corners */
    margin: 20px; /* Add margin around the header */
}

.header h2 {
    margin: 0 0 10px 0;
    font-size: 1.8em;
    color: #333;
    display: flex;
    align-items: center;
    flex-wrap: wrap; /* Allow title to wrap */
}

.webhook-id-title {
     font-weight: normal;
     word-break: break-all;
}

.header .webhook-info {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 8px;
}

.header .webhook-info strong {
    font-weight: bold; /* Make label strong */
    color: #333;
    display: inline-block; /* Ensure it takes space */
    margin-right: 5px;
}

.header .webhook-info a.webhook-url {
    color: #3498db;
    text-decoration: none;
    word-break: break-all;
    transition: color 0.2s ease;
}
.header .webhook-info a.webhook-url:hover {
    color: #2980b9;
    text-decoration: underline;
}

.copy-feedback {
    margin-left: 10px;
    font-size: 0.8em;
    color: #1abc9c; /* Teal color for success feedback */
    opacity: 0;
    transition: opacity 0.3s ease;
}
.copy-feedback.visible {
     opacity: 1;
}

.header .actions {
    margin-top: 15px; /* More space above button */
}

.header .actions button.delete-button {
    background-color: #e74c3c; /* Red */
    color: white;
    border: none;
    border-radius: 5px; /* Rounded corners */
    padding: 8px 15px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s ease, transform 0.1s ease;
}

.header .actions button.delete-button:hover {
    background-color: #c0392b; /* Darker red on hover */
     transform: translateY(-1px);
}
.header .actions button.delete-button:active {
     transform: translateY(0);
}


.content-area {
    flex-grow: 1;
    display: flex;
    gap: 20px; /* Space between message list and details */
    padding: 0 20px 20px 20px; /* Padding around the content area */
     /* height: calc(100vh - 220px); /* Adjust based on header/footer height */ 
     /* Remove fixed height, let flexbox manage it */
}

.messages-list {
    width: 320px; /* Fixed width for message list */
    overflow-y: auto;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px; /* Rounded corners */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    flex-shrink: 0; /* Prevent shrinking */
    display: flex; /* Use flexbox for header and items */
    flex-direction: column;
}

.messages-list h3 {
    margin: 0;
    padding: 15px;
    border-bottom: 1px solid #eee;
    font-size: 1.1em;
    background-color: #ecf0f1; /* Light grey header */
    border-top-left-radius: 8px; /* Match container border-radius */
    border-top-right-radius: 8px;
    flex-shrink: 0; /* Prevent header from shrinking */
}

.no-messages {
    padding: 20px;
    text-align: center;
    color: #777;
    font-style: italic;
}


.message-item {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s ease;
    word-break: break-word; /* Break long text */
    position: relative; /* Needed for new-label positioning */
}

.message-item:last-child {
    border-bottom: none; /* No border on the last item */
}

.message-item:hover {
    background-color: #f9f9f9; /* Very light grey on hover */
}

.message-item.active {
    background-color: #bdc3c7; /* Grey */
    color: #2c3e50; /* Dark text */
}
.message-item.active small {
     color: #34495e; /* Darker timestamp */
}

.message-item-recent {
    background-color: #e8f8f5; /* Light green background for new messages */
}
.message-item-recent:hover {
     background-color: #d1f2eb; /* Darker light green on hover */
}
.message-item-recent.active {
     background-color: #1abc9c !important; /* Force active color over recent background */
     color: white !important;
}
.message-item-recent.active small {
     color: #ecf0f1 !important; /* Force white timestamp in active state */
}


.new-label {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: #e67e22; /* Orange */
    color: white;
    font-size: 0.6em;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 3px;
    animation: pulse 1.5s infinite; /* Animation */
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}


.message-item p {
    margin: 0;
    font-size: 0.9em;
    white-space: nowrap; /* Prevent snippet from wrapping */
    overflow: hidden; /* Hide overflow */
    text-overflow: ellipsis; /* Show ellipsis */
    padding-right: 30px; /* Make space for the NEW label */
}

.message-item small {
    display: block;
    margin-top: 3px; /* Reduced margin */
    font-size: 0.7em;
    color: #777;
}

.message-details {
    flex-grow: 1; /* Take remaining space */
    padding: 15px;
    overflow-y: auto;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px; /* Rounded corners */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.message-details h3 {
    margin: 0 0 15px 0;
    font-size: 1.3em; /* Slightly larger */
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.detail-item {
    margin-bottom: 12px; /* More space */
    font-size: 0.95em;
}

.detail-item strong {
    display: inline-block;
    min-width: 120px; /* Increased width for labels */
    font-weight: bold;
    color: #555;
}

.detail-item span {
    word-break: break-all; /* Break long IDs/timestamps */
}


.raw-json {
    margin-top: 20px; /* Space above JSON block */
}

.raw-json strong {
    display: block; /* Label on its own line */
    margin-bottom: 8px;
    font-size: 1em;
     color: #555;
}

.raw-json pre {
    background-color: #f8f8f8; /* Lighter background */
    padding: 15px;
    border-radius: 5px; /* Rounded corners */
    overflow-x: auto; /* Allow horizontal scrolling for wide code */
    white-space: pre-wrap; /* Wrap long lines */
    word-wrap: break-word; /* Break long words */
    border: 1px solid #eee;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05); /* Subtle inner shadow */
}

.raw-json code {
    font-family: 'Consolas', 'Monaco', 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    line-height: 1.5; /* Improved readability */
    color: #333; /* Darker text */
}

.no-webhook-selected {
    text-align: center;
    padding: 50px;
    color: #777;
    margin-top: 50px; /* Push down from top */
    background-color: #fff;
    border-radius: 8px;
    margin: 50px auto; /* Center the block */
    max-width: 600px; /* Limit width */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.no-webhook-selected h2 {
    color: #555;
    margin-bottom: 15px;
}
.no-webhook-selected p {
    font-size: 1.1em;
}


/* Footer */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px; /* Fixed height */
    background-color: #2c3e50; /* Match dark sidebar header */
    color: #bdc3c7; /* Light grey text */
    padding: 0 20px; /* Padding inside footer */
    font-size: 0.8em;
    display: flex; /* Use flexbox */
    justify-content: space-between; /* Put items on opposite ends */
    align-items: center; /* Vertically align items */
    box-sizing: border-box; /* Include padding in width/height */
    z-index: 1000; /* Ensure footer is on top */
    box-shadow: 0 -2px 5px rgba(0,0,0,0.1); /* Shadow on top */
}

.footer strong {
    color: #ecf0f1; /* Lighter color for emphasis */
}