* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
}

.app-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    flex-wrap: wrap;
    justify-content: center;
}

/* iPhone Frame */
.iphone-frame {
    width: 375px;
    height: 812px;
    background: #000;
    border-radius: 45px;
    padding: 12px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.iphone-frame::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 30px;
    background: #000;
    border-radius: 0 0 20px 20px;
    z-index: 10;
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px 10px;
    background: #f2f2f7;
    border-radius: 35px 35px 0 0;
}

.time {
    font-weight: 600;
    font-size: 14px;
}

.status-icons {
    display: flex;
    gap: 5px;
    font-size: 12px;
}

/* Chat Header */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: #f2f2f7;
    border-bottom: 1px solid #e5e5ea;
}

.back-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #007aff;
    cursor: pointer;
    padding: 0 10px;
}

.contact-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.profile-circle {
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
}

.contact-name {
    font-size: 11px;
    color: #000;
}

.video-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
}

/* Chat Container */
.chat-container {
    height: 620px;
    background: #fff;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    scroll-behavior: smooth;
}

.chat-messages {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 100%;
}

/* Message Bubbles */
.message {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 16px;
    line-height: 1.4;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    animation: messageAppear 0.4s ease forwards;
}

@keyframes messageAppear {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message.sender {
    background: #007aff;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message.receiver {
    background: #e5e5ea;
    color: #000;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

/* Timestamp Divider */
.timestamp-divider {
    text-align: center;
    margin: 12px 0 8px;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

.timestamp-divider span {
    font-size: 11px;
    color: #8e8e93;
    background: rgba(142, 142, 147, 0.12);
    padding: 4px 12px;
    border-radius: 10px;
    letter-spacing: 0.2px;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.message-time {
    font-size: 11px;
    color: #8e8e93;
    margin-top: 2px;
    text-align: right;
}

.message.sender .message-time {
    color: rgba(255, 255, 255, 0.7);
}

/* Typing Indicator */
.typing-indicator {
    padding: 10px 15px;
    display: none;
}

.typing-indicator.active {
    display: block;
}

.typing-dots {
    background: #e5e5ea;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #8e8e93;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Input Bar */
.input-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #f2f2f7;
    border-radius: 0 0 35px 35px;
}

.input-field {
    flex: 1;
    padding: 10px 15px;
    background: #fff;
    border-radius: 20px;
    border: 1px solid #e5e5ea;
    font-size: 16px;
    color: #8e8e93;
}

.send-btn {
    width: 32px;
    height: 32px;
    background: #007aff;
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Control Panel */
.control-panel {
    width: 350px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.control-panel h2 {
    color: #1a1a2e;
    margin-bottom: 20px;
    font-size: 24px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.input-group input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e5e5ea;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.input-group input[type="text"]:focus {
    outline: none;
    border-color: #007aff;
}

.input-group textarea {
    width: 100%;
    height: 180px;
    padding: 15px;
    border: 2px solid #e5e5ea;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
}

.input-group textarea:focus {
    outline: none;
    border-color: #007aff;
}

/* Speed Controls */
.speed-controls {
    display: flex;
    gap: 10px;
}

.speed-btn {
    padding: 8px 20px;
    border: 2px solid #e5e5ea;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.speed-btn:hover {
    border-color: #007aff;
}

.speed-btn.active {
    background: #007aff;
    color: white;
    border-color: #007aff;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    flex: 1;
    min-width: 100px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #007aff;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #0056b3;
}

.btn-success {
    background: #34c759;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #2da44e;
}

.btn-warning {
    background: #ff9500;
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background: #e68600;
}

.btn-info {
    background: #5856d6;
    color: white;
    width: 100%;
}

.btn-info:hover {
    background: #4745b5;
}

/* Instructions */
.instructions {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #5856d6;
}

.instructions h3 {
    color: #5856d6;
    margin-bottom: 10px;
}

.instructions ol {
    padding-left: 20px;
    color: #333;
}

.instructions li {
    margin-bottom: 8px;
}

.instructions p {
    margin-top: 10px;
    font-size: 13px;
    color: #666;
}

.hidden {
    display: none;
}

/* Checkbox styling */
.input-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    vertical-align: middle;
}

.checkbox-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.checkbox-row label {
    display: flex;
    align-items: center;
    font-weight: 400;
    cursor: pointer;
}

.sound-options > label:first-of-type {
    margin-bottom: 8px;
}

.music-file-input {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #e5e5ea;
    transition: all 0.3s;
}

.music-file-input.loaded {
    border-color: #34c759;
    background: #f0fff4;
}

.music-file-input input[type="file"] {
    width: 100%;
    font-size: 13px;
}

.music-file-input small {
    display: block;
    margin-top: 5px;
    color: #8e8e93;
    font-size: 11px;
}

/* Scrollbar styling */
.chat-container::-webkit-scrollbar {
    width: 6px;
}

.chat-container::-webkit-scrollbar-track {
    background: transparent;
}

.chat-container::-webkit-scrollbar-thumb {
    background: #c7c7cc;
    border-radius: 3px;
}

/* Responsive */
@media (max-width: 800px) {
    .app-container {
        flex-direction: column;
        align-items: center;
    }
    
    .control-panel {
        width: 375px;
    }
}

@media (max-width: 400px) {
    .iphone-frame {
        width: 100%;
        max-width: 375px;
        height: auto;
        min-height: 700px;
    }
    
    .chat-container {
        height: 500px;
    }
    
    .control-panel {
        width: 100%;
    }
}
