* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: #2c3e50;
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    color: #7f8c8d;
    font-size: 1.1em;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    height: calc(100vh - 200px);
}

/* Chat Section */
.chat-section {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chat-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.chat-header {
    background: #2c3e50;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    font-size: 1.2em;
}

.status {
    display: flex;
    align-items: center;
    font-size: 0.9em;
}

.status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #2ecc71;
    border-radius: 50%;
    margin-right: 5px;
    display: inline-block;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.message {
    display: flex;
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    margin-right: 10px;
    flex-shrink: 0;
}

.bot-message .message-avatar {
    background: #3498db;
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .message-avatar {
    background: #2ecc71;
    margin-right: 0;
    margin-left: 10px;
}

.message-content {
    background: white;
    padding: 10px 15px;
    border-radius: 10px;
    max-width: 80%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.user-message .message-content {
    background: #3498db;
    color: white;
}

.message-content p {
    margin-bottom: 5px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.chat-input-container {
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 0.95em;
    outline: none;
}

.chat-input:focus {
    border-color: #3498db;
}

.send-button {
    padding: 10px 25px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.send-button:hover {
    background: #2980b9;
}

/* Resume Section */
.resume-section {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.resume-controls {
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.resume-controls h3 {
    color: #2c3e50;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.btn-primary, .btn-secondary {
    padding: 8px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary {
    background: #27ae60;
    color: white;
}

.btn-primary:hover {
    background: #229954;
}

.btn-secondary {
    background: #ecf0f1;
    color: #2c3e50;
}

.btn-secondary:hover {
    background: #bdc3c7;
}

.resume-preview {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #95a5a6;
}

.empty-state svg {
    opacity: 0.3;
    margin-bottom: 20px;
}

/* Resume Content */
.resume-content {
    background: white;
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    min-height: 1000px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    width: 90%;
    max-width: 1000px;
    border-radius: 10px;
    overflow: hidden;
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 20px;
    background: #2c3e50;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close {
    font-size: 28px;
    cursor: pointer;
    transition: opacity 0.3s;
}

.close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 30px;
    max-height: 70vh;
    overflow-y: auto;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.template-card {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
}

.template-card:hover {
    border-color: #3498db;
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.template-card.selected {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.template-preview {
    height: 200px;
    background: #f8f9fa;
    position: relative;
    overflow: hidden;
}

.template-name {
    padding: 15px;
    text-align: center;
    font-weight: 500;
    background: white;
    border-top: 1px solid #e0e0e0;
}

/* Template Item Styling */
.template-item {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.template-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.template-item.selected {
    border: 3px solid #3498db;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(52, 152, 219, 0.3);
}

.template-item.selected .template-name {
    background: #3498db;
    color: white;
    font-weight: 600;
}

/* Template Preview Thumbnails */
.template-preview {
    position: relative;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.template-thumbnail {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 15px;
    color: white;
    font-size: 10px;
    line-height: 1.2;
}

.template-thumbnail.modern {
    background: linear-gradient(135deg, #3498db 0%, #2c3e50 100%);
}

.template-thumbnail.classic {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

.template-thumbnail.creative {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.template-thumbnail.minimal {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
}

.template-thumbnail.professional {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
}

.template-thumbnail.elegant {
    background: linear-gradient(135deg, #8e44ad 0%, #7d3c98 100%);
}

.template-thumbnail.corporate {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
}

.template-thumbnail.bold {
    background: linear-gradient(135deg, #e67e22 0%, #d68910 100%);
}

.template-thumbnail.simple {
    background: linear-gradient(135deg, #bdc3c7 0%, #95a5a6 100%);
}

.template-thumbnail.executive {
    background: linear-gradient(135deg, #1abc9c 0%, #16a085 100%);
}

.thumb-header {
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.3);
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.thumb-name {
    font-weight: bold;
    font-size: 12px;
}

.thumb-title {
    font-size: 8px;
    opacity: 0.8;
}

.thumb-section {
    margin-bottom: 6px;
}

.thumb-section-title {
    font-weight: bold;
    font-size: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    margin-bottom: 3px;
}

.thumb-line {
    height: 2px;
    background: rgba(255,255,255,0.6);
    margin: 2px 0;
    border-radius: 1px;
}

.thumb-line.short {
    width: 60%;
}

.thumb-line.medium {
    width: 80%;
}

.thumb-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}

.thumb-skill {
    background: rgba(255,255,255,0.2);
    padding: 1px 3px;
    border-radius: 2px;
    font-size: 6px;
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 1024px) {
    .container {
        padding: 15px;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        height: auto;
        gap: 20px;
    }
    
    .chat-section {
        height: 60vh;
        min-height: 400px;
    }
    
    .resume-section {
        height: 70vh;
        min-height: 500px;
    }
    
    .chat-messages {
        padding: 15px;
    }
    
    .message-content {
        max-width: calc(100% - 60px);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        margin-bottom: 20px;
    }
    
    header h1 {
        font-size: 1.8em;
        margin-bottom: 5px;
    }
    
    header p {
        font-size: 1em;
    }
    
    .main-content {
        gap: 15px;
    }
    
    .chat-section {
        height: 50vh;
        min-height: 350px;
    }
    
    .resume-section {
        height: 60vh;
        min-height: 400px;
    }
    
    .chat-header {
        padding: 12px 15px;
    }
    
    .chat-header h3 {
        font-size: 1.1em;
    }
    
    .chat-messages {
        padding: 10px;
    }
    
    .message {
        margin-bottom: 12px;
    }
    
    .message-avatar {
        width: 35px;
        height: 35px;
        font-size: 16px;
        margin-right: 10px;
    }
    
    .message-content {
        font-size: 14px;
        max-width: calc(100% - 50px);
    }
    
    .chat-input-container {
        padding: 12px;
        gap: 8px;
    }
    
    .chat-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
    }
    
    .send-button {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .resume-controls h3 {
        font-size: 1.1em;
    }
    
    .action-buttons {
        gap: 8px;
        flex-direction: column;
    }
    
    .btn-primary, .btn-secondary {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .modal-content {
        margin: 0;
        width: 100%;
        height: 100vh;
        border-radius: 0;
        max-height: none;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-header h2 {
        font-size: 1.3em;
    }
    
    .modal-body {
        padding: 15px;
        flex: 1;
        overflow-y: auto;
    }
    
    .template-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .template-item {
        margin-bottom: 0;
    }
    
    .template-thumbnail {
        height: 150px;
        padding: 12px;
    }
    
    .template-name {
        padding: 12px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    header h1 {
        font-size: 1.5em;
    }
    
    .chat-section {
        height: 45vh;
        min-height: 300px;
    }
    
    .resume-section {
        height: 50vh;
        min-height: 350px;
    }
    
    .chat-header {
        padding: 10px 12px;
    }
    
    .chat-messages {
        padding: 8px;
    }
    
    .message-avatar {
        width: 30px;
        height: 30px;
        font-size: 14px;
        margin-right: 8px;
    }
    
    .message-content {
        font-size: 13px;
        max-width: calc(100% - 45px);
    }
    
    .chat-input-container {
        padding: 10px;
        flex-direction: column;
        gap: 8px;
    }
    
    .chat-input {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .send-button {
        width: 100%;
        padding: 12px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .template-thumbnail {
        height: 120px;
        padding: 10px;
        font-size: 8px;
    }
    
    .thumb-name {
        font-size: 10px;
    }
    
    .thumb-title {
        font-size: 7px;
    }
    
    .thumb-section-title {
        font-size: 7px;
    }
}

/* Touch-friendly improvements */
@media (pointer: coarse) {
    .send-button, .btn-primary, .btn-secondary {
        min-height: 44px; /* Apple's recommended touch target size */
    }
    
    .template-item {
        cursor: pointer;
    }
    
    .template-item:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}