/* Basic Reset & Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.7;
    background-color: #f8f9fa; /* Light overall page background */
    color: #343a40; /* Default text color */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.page-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: #034737; /* Primary color for links */
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container { /* General purpose container, used by tool sections */
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1rem;
}


/* Site Header */
.site-header {
    background-color: #fff;
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border-bottom: 1px solid #e9ecef;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: #034737; /* Primary color */
    letter-spacing: -1px;
}

.main-nav a {
    color: #495057;
    margin-left: 1.5rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.main-nav a:hover {
    color: #034737;
    text-decoration: none;
}

.btn-cta-header {
    background-color: #034737;
    color: #fff !important; /* Important to override general link color */
    padding: 0.6rem 1.2rem;
    border-radius: 5px;
    font-weight: 500;
    margin-left: 1.5rem;
    transition: background-color 0.3s ease;
}

.btn-cta-header:hover {
    background-color: #02362a; /* Darker shade */
    text-decoration: none;
}

/* Hero Section */
.hero-section {
    background-color: #fff; /* Can be different, e.g., a light gradient or image */
    padding: 4rem 2rem;
    text-align: center;
    border-bottom: 1px solid #e9ecef;
}

.hero-container {
    max-width: 800px;
    margin: 0 auto;
}

.hero-section h1 {
    font-size: 2.8rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-section .subtitle {
    font-size: 1.15rem;
    color: #6c757d;
    max-width: 650px;
    margin: 0 auto 2rem auto;
}

/* Main Tool Area Wrapper */
.tool-container-wrapper {
    padding: 3rem 1rem; /* More padding around the tool */
    background-color: #f8f9fa; /* Match body or slightly different */
    flex-grow: 1;
}

.tool-container {
    max-width: 960px; /* Wider for better internal layout */
    margin: 0 auto;
    background-color: #fff;
    padding: 2rem; /* Padding inside the dotted border */
    border: 2px dashed #034737; /* Dotted border with primary color */
    border-radius: 12px; /* Slightly rounded corners for the container */
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
}

/* Tabs Navigation - Restyled */
.tabs-navigation {
    display: flex;
    margin-bottom: 2rem; /* More space below tabs */
    border-bottom: 1px solid #dee2e6; /* Lighter border */
}

.tab-link {
    padding: 0.8rem 1.2rem; /* Slightly adjusted padding */
    cursor: pointer;
    border: none;
    background-color: transparent;
    font-size: 1.05rem; /* Slightly larger */
    font-weight: 500;
    color: #495057;
    margin-right: 0.5rem; /* Space between tab links */
    border-bottom: 3px solid transparent;
    transition: color 0.2s ease, border-bottom-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.tab-link i {
    font-size: 1em; /* Icons relative to text */
    margin-right: 0.3rem;
}
.tab-link:hover {
    color: #034737;
}
.tab-link.active {
    color: #034737;
    border-bottom-color: #034737;
    font-weight: 600;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Cards within the tool - Lighter styling */
.tool-container .card {
    background-color: #fff; /* Keep white or make transparent if tool-container has bg */
    border: 1px solid #e9ecef; /* Lighter border for cards */
    padding: 1.5rem;
    margin-bottom: 2rem; /* Increased space between cards */
    box-shadow: none; /* Remove individual card shadows if container has one */
    border-radius: 8px;
}
.tool-container .card h2 {
    color: #034737;
    margin-bottom: 1.5rem; /* More space below heading */
    font-weight: 600;
    font-size: 1.2rem; /* Slightly smaller for internal headings */
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 0.75rem;
}

.form-group {
    margin-bottom: 1.25rem; /* Slightly more space */
    position: relative; 
}
.form-group label {
    display: block;
    margin-bottom: 0.6rem; /* More space for label */
    font-weight: 500;
    color: #495057; /* Slightly darker label */
    font-size: 0.9rem;
}

/* Search Input & Results - Styles for these remain largely same, but container affects them */
#search-templates-input { margin-bottom: 0; }
.search-results { /* Ensure z-index and positioning are correct within new layout */
    position: absolute; top: 100%; left: 0; right: 0;
    background-color: #fff; border: 1px solid #ced4da; border-top: none;
    border-radius: 0 0 6px 6px; max-height: 220px; overflow-y: auto;
    z-index: 1050; box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.search-result-item { padding: 0.8rem 1rem; cursor: pointer; border-bottom: 1px solid #f1f1f1; font-size: 0.9rem; }
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background-color: #f8f9fa; }
.search-result-item .template-name { font-weight: 500; color: #212529; }
.search-result-item .template-category-hint { font-size: 0.8em; color: #6c757d; display: block; margin-top: 3px; }


.form-control,
#edit-template-name, 
#edit-template-body,
#whatsapp-phone-number {
    width: 100%;
    padding: 0.75rem 1rem; /* More padding */
    border: 1px solid #ced4da; /* Standard bootstrap-like border */
    border-radius: 6px; /* More rounded */
    font-size: 0.95rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.form-control:focus,
#edit-template-name:focus, 
#edit-template-body:focus,
#whatsapp-phone-number:focus {
    border-color: #034737;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(3, 71, 55, 0.25);
}
#edit-template-body {
    min-height: 120px; /* Good height for textarea */
}

/* User Template Edit Controls */
#user-template-edit-controls {
    border: 1px solid #e0e0e0; /* Lighter dashed border */
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: 6px;
    background-color: #fdfdfd; /* Very light background */
}
.edit-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }
.edit-hr { margin-top: 1.5rem; margin-bottom: 1.5rem; border: 0; border-top: 1px solid #e0e0e0; }


/* Message Box (for final output) */
.message-box { 
    background-color: #f1f3f5; /* Lighter background */
    border: 1px solid #dee2e6;
    border-left: 4px solid #034737;
    padding: 1rem 1.25rem;
    border-radius: 6px;
    min-height: 100px;
    white-space: pre-wrap;
    font-size: 0.95rem;
    color: #212529;
    line-height: 1.6;
}

/* Buttons Restyled */
.actions { margin-top: 1.5rem; display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.btn {
    padding: 0.7rem 1.4rem; /* Adjusted padding */
    border: 1px solid transparent; /* Base for outline buttons if needed */
    border-radius: 6px; /* Consistent rounding */
    cursor: pointer;
    font-size: 0.95rem; /* Slightly smaller button text */
    font-weight: 500; /* Medium weight */
    text-decoration: none;
    text-align: center;
    transition: all 0.2s ease; /* Smoother transition */
    display: inline-flex; align-items: center; gap: 0.6rem;
}
.btn i { font-size: 0.95em; }

.btn-primary { background-color: #034737; color: white; border-color: #034737; }
.btn-primary:hover { background-color: #02362a; border-color: #02362a; }
.btn-secondary { background-color: #6c757d; color: white; border-color: #6c757d; }
.btn-secondary:hover { background-color: #5a6268; border-color: #545b62; }
.btn-success { background-color: #28a745; color: white; border-color: #28a745; }
.btn-success:hover { background-color: #218838; border-color: #1e7e34; }
.btn-danger { background-color: #dc3545; color: white; border-color: #dc3545; }
.btn-danger:hover { background-color: #c82333; border-color: #bd2130; }
.btn-whatsapp { background-color: #25D366; color: white; border-color: #25D366; }
.btn-whatsapp:hover { background-color: #1DA851; border-color: #1DA851; }

.hidden { display: none !important; }

/* Tab Navigation Buttons within cards */
.tab-navigation-buttons { margin-top: 2rem; text-align: right; }
#tab-preview-output .tab-navigation-buttons { text-align: left; }

/* Mobile Preview - existing styles should largely work, ensure container is fine */
#mobile-preview-wrapper { /* Styles remain same */ }
/* ... (all other existing mobile preview styles: .phone-frame, .phone-screen, etc. remain same) ... */
/* You may need to adjust margins or padding of #mobile-preview-wrapper if it looks off in the new card style */
#preview-area.card { /* The card containing the preview */
    padding-bottom: 0; /* Remove bottom padding if #mobile-preview-wrapper handles it */
}
#mobile-preview-wrapper {
    padding: 1.5rem 0; /* Add padding here instead of card if needed */
}


/* Site Footer */
.site-footer {
    background-color: #212529; /* Dark background */
    color: #adb5bd; /* Light grey text */
    padding: 3rem 0 1rem 0;
    margin-top: auto; /* Push to bottom if content is short */
}
.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 2rem;
}
.footer-column {
    flex: 1;
    min-width: 200px; /* Prevent columns from getting too narrow */
    margin-bottom: 1.5rem;
}
.footer-column h4 {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}
.footer-column p {
    font-size: 0.9rem;
    line-height: 1.7;
}
.footer-column ul {
    list-style: none;
    padding: 0;
}
.footer-column ul li {
    margin-bottom: 0.6rem;
}
.footer-column ul li a {
    color: #adb5bd;
    font-size: 0.9rem;
}
.footer-column ul li a:hover {
    color: #fff;
    text-decoration: underline;
}
.social-icons a {
    color: #adb5bd;
    margin-right: 1rem;
    font-size: 1.2rem;
    transition: color 0.3s ease;
}
.social-icons a:hover {
    color: #fff;
}
.footer-bottom {
    text-align: center;
    padding: 1.5rem 0 1rem 0;
    margin-top: 2rem;
    border-top: 1px solid #343a40; /* Separator line */
    font-size: 0.85rem;
}
.footer-bottom a {
    color: #ced4da;
}
.footer-bottom a:hover {
    color: #fff;
}

/* --- Ensuring Mobile Preview Styles are present (copied from previous complete state) --- */
/* (These were marked as "no changes" but including them for a truly complete CSS file here) */
.phone-frame { width: 320px; height: 650px; background-color: #1c1c1e; border-radius: 40px; padding: 12px; box-shadow: 0 15px 35px rgba(0,0,0,0.35), inset 0 0 0 2px #333, 0 0 0 4px #1c1c1e; position: relative; display: flex; flex-direction: column; }
.phone-top-bar { height: 30px; display: flex; justify-content: space-between; align-items: center; padding: 0 10px; position: absolute; top: 15px; left: 15px; right: 15px; color: #fff; font-size: 0.8em; z-index: 10; }
.phone-time { font-weight: 600; }
.phone-island-notch { position: absolute; left: 50%; transform: translateX(-50%); width: 120px; height: 30px; background-color: #1c1c1e; border-radius: 0 0 15px 15px; display: flex; align-items: center; justify-content: center; }
.phone-camera { width: 8px; height: 8px; background-color: #444; border-radius: 50%; }
.phone-screen { background-color: #e5ddd5; flex-grow: 1; min-height: 0; border-radius: 28px; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.chat-header { background-color: #075e54; color: white; padding: 10px 12px; display: flex; align-items: center; gap: 10px; flex-shrink: 0; box-shadow: 0 1px 2px rgba(0,0,0,0.1); z-index: 1; }
.chat-back-arrow { font-size: 1.5em; font-weight: 300; margin-right: 5px; }
.chat-contact-avatar { width: 40px; height: 40px; background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23cccccc"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg>'); background-size: cover; background-color: #bbb; border-radius: 50%; }
.chat-contact-info { display: flex; flex-direction: column; flex-grow: 1; }
.chat-contact-name { font-weight: 500; font-size: 1.05em; }
.chat-contact-status { font-size: 0.75em; color: #a0d9c3; }
.chat-header-actions i { margin-left: 18px; font-size: 1.1em; cursor: pointer; }
.chat-messages-area { flex-grow: 1; padding: 10px 8px; overflow-y: auto; display: flex; flex-direction: column; min-height: 0; }
.message-date-separator { text-align: center; margin: 10px 0; }
.message-date-separator span { background-color: #e1f2fb; color: #506A7A; padding: 3px 10px; border-radius: 8px; font-size: 0.7em; text-transform: uppercase; font-weight: 500; }
.message-bubble-wrapper { display: flex; flex-direction: column; margin-bottom: 10px; max-width: 100%; }
.message-bubble-wrapper.sent { align-items: flex-end; }
.message-bubble-wrapper.received { align-items: flex-start; }
.message-bubble { max-width: 80%; padding: 7px 10px; border-radius: 7.5px; line-height: 1.4; word-wrap: break-word; white-space: pre-wrap; font-size: 0.92em; box-shadow: 0 1px 0.5px rgba(0,0,0,0.13); position: relative; }
.message-bubble-wrapper.sent .message-bubble { background-color: #dcf8c6; color: #303030; }
.message-bubble-wrapper.sent .message-bubble::after { content: ''; position: absolute; top: 0px; right: -6px; width: 0; height: 0; border-style: solid; border-width: 0 0 10px 10px; border-color: transparent transparent #dcf8c6 transparent; }
.message-bubble-wrapper.received .message-bubble { background-color: #fff; color: #303030; }
.message-bubble-wrapper.received .message-bubble::before { content: ''; position: absolute; top: 0px; left: -6px; width: 0; height: 0; border-style: solid; border-width: 0 10px 10px 0; border-color: transparent #fff transparent transparent; }
.timestamp-status { display: flex; align-items: center; font-size: 0.7em; color: #667781; margin-top: 1px; }
.message-bubble-wrapper.sent .timestamp-status { align-self: flex-end; margin-right: 10px; }
.message-bubble-wrapper.received .timestamp-status { align-self: flex-start; margin-left: 10px; }
.message-bubble-wrapper.received .timestamp { color: #667781; }
.read-receipts { margin-left: 3px; font-weight: bold; color: #53bdeb; }
.chat-input-bar { background-color: #f0f0f0; padding: 6px 10px; display: flex; align-items: center; gap: 12px; border-top: 1px solid #ddd; flex-shrink: 0; }
.chat-input-bar i { font-size: 1.3em; color: #54656f; cursor: pointer; }
.chat-input-text { flex-grow: 1; background-color: #fff; border: none; padding: 9px 12px; border-radius: 20px; color: #333; font-size: 0.95em; }
.chat-input-text::placeholder { color: #8696a0; }
.phone-side-buttons { position: absolute; left: -4px; top: 80px; width: 4px; }
.phone-side-buttons .phone-button { display: block; height: 30px; background-color: #444; border-radius: 2px 0 0 2px; margin-bottom: 10px; }
.phone-side-buttons .phone-button:nth-child(2) { height: 50px; }
.phone-side-buttons .phone-button:nth-child(3) { margin-top: 20px; height: 50px; }
.phone-bottom-bar { width: 130px; height: 4px; background-color: #555; border-radius: 2px; position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); }