:root {
    --primary: #007AFF;
    --bg-color: #f5f5f7;
    --card-bg: rgba(255, 255, 255, 0.85);
    --border-color: rgba(255, 255, 255, 0.4);
    --text-color: #1d1d1f;
    --secondary-text: #86868b;
    --input-bg: #fbfbfd;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 15px;
}

/* Bubble Background */
.bubble-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}
.bubble {
    position: absolute;
    border-radius: 50%;
    background: rgba(0, 122, 255, 0.08);
    animation: float 15s infinite ease-in-out alternate;
    filter: blur(40px);
}
.bubble-1 { width: 400px; height: 400px; top: -100px; left: -100px; }
.bubble-2 { width: 500px; height: 500px; bottom: -150px; right: -100px; animation-delay: -2s; background: rgba(52, 199, 89, 0.08); }
.bubble-3 { width: 300px; height: 300px; bottom: 20%; left: 20%; animation-delay: -5s; background: rgba(255, 59, 48, 0.05); }

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, -50px) scale(1.1); }
}

.main-container {
    width: 100%;
    max-width: 1100px;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    margin-bottom: 40px;
}

.page-title {
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: -1px;
    margin: 0 0 10px 0;
    text-align: center;
}

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

.split-layout {
    display: flex;
    gap: 40px;
}

.control-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.preview-panel {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.control-section {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    border: 1px solid #e5e5ea;
}

.control-section h3 {
    margin-top: 0;
    font-size: 1.1rem;
    color: var(--primary);
    border-bottom: 1px solid #f2f2f7;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.input-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}
.input-grid .input-group {
    margin-bottom: 0;
}

.input-group label {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--secondary-text);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.input-group input, 
.input-group select, 
.input-group textarea {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1.5px solid #e5e5ea;
    background: var(--input-bg);
    font-size: 0.95rem;
    font-weight: 600;
    outline: none;
    transition: 0.2s border-color;
    font-family: inherit;
    resize: vertical;
}

.input-group input:focus, 
.input-group select:focus, 
.input-group textarea:focus {
    border-color: var(--primary);
    background: #fff;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: 0.2s;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: #0056b3;
}

.btn-outline {
    background: transparent;
    color: #ff3b30;
    border: 1.5px solid #ff3b30;
}
.btn-outline:hover {
    background: #fff0f0;
}

/* =========================================================
   PHONE PREVIEW COMPONENT
   ========================================================= */

.phone-frame {
    width: 350px;
    height: 700px;
    background-color: var(--p-bg);
    border-radius: 40px;
    border: 12px solid #222;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: var(--p-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* CSS Variables for Themes & Platforms */
.phone-frame.light {
    --p-bg: #e5ddd5;
    --p-text: #000000;
    --p-header-bg: #075e54;
    --p-header-text: #ffffff;
    --p-msg-sent-bg: #dcf8c6;
    --p-msg-recv-bg: #ffffff;
    --p-msg-time: #999999;
}
.phone-frame.dark {
    --p-bg: #0b141a;
    --p-text: #e9edef;
    --p-header-bg: #202c33;
    --p-header-text: #e9edef;
    --p-msg-sent-bg: #005c4b;
    --p-msg-recv-bg: #202c33;
    --p-msg-time: #8696a0;
}

/* iMessage overrides */
.phone-frame.imessage.light {
    --p-bg: #ffffff;
    --p-header-bg: #f9f9f9;
    --p-header-text: #000000;
    --p-msg-sent-bg: #0b93f6;
    --p-msg-recv-bg: #e5e5ea;
}
.phone-frame.imessage.dark {
    --p-bg: #000000;
    --p-header-bg: #1c1c1e;
    --p-header-text: #ffffff;
    --p-msg-sent-bg: #0b93f6;
    --p-msg-recv-bg: #262628;
}

/* Base phone UI */
.notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 30px;
    background-color: #222;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    z-index: 100;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    padding: 12px 25px 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--p-header-text);
    background-color: var(--p-header-bg);
    z-index: 90;
}

.status-bar .icons {
    display: flex;
    gap: 5px;
}

.chat-header {
    background-color: var(--p-header-bg);
    color: var(--p-header-text);
    padding: 10px 15px;
    display: flex;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    z-index: 90;
}

.back-btn {
    background: none;
    border: none;
    color: var(--p-header-text);
    font-size: 24px;
    margin-right: 10px;
    cursor: default;
}

.contact-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.avatar {
    width: 40px;
    height: 40px;
    background: #ccc;
    border-radius: 50%;
    margin-right: 12px;
}

.details .name {
    font-weight: 600;
    font-size: 15px;
}

.details .status {
    font-size: 12px;
    opacity: 0.8;
}

.header-actions {
    display: flex;
    gap: 15px;
}

/* Chat Body */
.chat-body {
    flex: 1;
    background-color: var(--p-bg);
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background-size: cover;
}

/* WhatsApp Light Background */
.phone-frame.whatsapp.light .chat-body {
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='rgba(0,0,0,0.05)' d='M... (simplified pattern)'/%3E%3C/svg%3E");
}

/* Messages */
.message {
    max-width: 80%;
    padding: 8px 12px;
    position: relative;
    word-wrap: break-word;
    display: flex;
    flex-direction: column;
}

.message .msg-text {
    font-size: 15px;
    line-height: 1.4;
    white-space: pre-wrap;
}

.message .msg-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.message .time {
    font-size: 11px;
    color: var(--p-msg-time);
}

.message .ticks {
    font-size: 12px;
}
.ticks.read { color: #53bdeb; }
.ticks.delivered { color: var(--p-msg-time); }
.ticks.sent { color: var(--p-msg-time); }

/* Message Roles */
.msg-received {
    align-self: flex-start;
    background-color: var(--p-msg-recv-bg);
    border-radius: 0 10px 10px 10px;
}
.msg-received .ticks { display: none; } /* Received messages don't show read receipts from the sender's perspective in this UI */

.msg-sent {
    align-self: flex-end;
    background-color: var(--p-msg-sent-bg);
    border-radius: 10px 0 10px 10px;
}

/* iMessage overrides */
.phone-frame.imessage .message {
    padding: 10px 14px;
    border-radius: 20px;
}
.phone-frame.imessage .msg-sent {
    background-color: var(--p-msg-sent-bg);
    color: #fff;
    border-bottom-right-radius: 5px;
}
.phone-frame.imessage .msg-received {
    background-color: var(--p-msg-recv-bg);
    color: var(--p-text);
    border-bottom-left-radius: 5px;
}
.phone-frame.imessage .msg-sent .time {
    color: rgba(255,255,255,0.7);
}
.phone-frame.imessage .chat-header {
    justify-content: center;
    padding-top: 15px;
}
.phone-frame.imessage .contact-info {
    flex-direction: column;
    justify-content: center;
    flex: none;
}
.phone-frame.imessage .avatar {
    width: 50px;
    height: 50px;
    margin: 0 0 5px 0;
}
.phone-frame.imessage .header-actions {
    display: none;
}
.phone-frame.imessage .back-btn {
    position: absolute;
    left: 15px;
    color: var(--primary);
}
.phone-frame.imessage .status-bar {
    background-color: transparent;
    color: var(--p-text);
    position: absolute;
    width: 100%;
    box-sizing: border-box;
    padding-top: 15px;
}
.phone-frame.imessage .chat-header {
    padding-top: 40px;
}

/* Footer */
.chat-footer {
    background-color: var(--p-header-bg);
    padding: 10px 15px 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.input-bar {
    flex: 1;
    background: var(--p-msg-recv-bg);
    color: var(--p-msg-time);
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 15px;
}

/* =========================================================
   GENERIC PAGE STYLES
   ========================================================= */
.info-container {
    width: 100%;
    max-width: 1100px;
    background: #fff;
    border-radius: 24px;
    padding: 40px 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.03);
    margin-bottom: 40px;
    text-align: left;
}

.info-container h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 2px solid #f2f2f7;
    padding-bottom: 10px;
}

.info-container ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.info-container li {
    margin-bottom: 15px;
    font-size: 1.05rem;
    line-height: 1.6;
    color: #444;
    position: relative;
    padding-left: 25px;
}

.info-container li::before {
    content: '★';
    position: absolute;
    left: 0;
    color: var(--primary);
}

@media (max-width: 900px) {
    .split-layout {
        flex-direction: column;
    }
}
