/* ===== TEMEL RESET ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ===== BODY VE TEMEL STILLER ===== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ===== APP CONTAINER ===== */
.app-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 800px;
    min-height: 600px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* ===== HEADER ===== */
.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    text-align: center;
}

.app-header h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 5px;
}

.app-header p {
    font-size: 14px;
    opacity: 0.9;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    padding: 30px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

/* ===== INPUT SECTION ===== */
.input-section {
    padding: 25px;
    background: white;
    border-bottom: 1px solid #e9ecef;
}

.management-section {
    margin-bottom: 25px;
}

.management-section:last-of-type {
    margin-bottom: 20px;
}

.input-group {
    margin-bottom: 15px;
}

.input-row {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 15px;
}

.input-row label {
    min-width: 100px;
    font-weight: 600;
    color: #495057;
    font-size: 15px;
}

.input-with-controls {
    flex: 1;
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.topic-select, .player-select {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 15px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s, box-shadow 0.3s;
    min-width: 200px;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topic-input, .player-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 15px;
    transition: border-color 0.3s, box-shadow 0.3s;
    min-width: 200px;
    max-width: 300px;
}

.topic-select:focus, .player-select:focus,
.topic-input:focus, .player-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.add-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 10px;
    width: 45px;
    height: 45px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.3s;
    box-shadow: 0 2px 10px rgba(40, 167, 69, 0.3);
    flex-shrink: 0;
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

.add-btn:active {
    transform: translateY(0);
}

.add-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ===== SAVED ITEMS ===== */
.saved-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    min-height: 35px;
}

.saved-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 13px;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.saved-item:hover {
    background: #e9ecef;
}

.item-name {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-controls {
    display: flex;
    gap: 4px;
}

.edit-btn, .delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 12px;
    transition: background-color 0.2s;
}

.edit-btn {
    color: #007bff;
}

.edit-btn:hover {
    background: rgba(0, 123, 255, 0.1);
}

.delete-btn {
    color: #dc3545;
}

.delete-btn:hover {
    background: rgba(220, 53, 69, 0.1);
}

.button-row {
    display: flex;
    justify-content: center;
    margin-top: 25px;
}

/* ===== GENERATE BUTTON ===== */
.generate-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s, box-shadow 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.generate-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.generate-button:active {
    transform: translateY(0);
}

.generate-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.placeholder-message {
    text-align: center;
    color: #6c757d;
}

.placeholder-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.placeholder-message p {
    font-size: 16px;
    line-height: 1.5;
}

/* ===== MESSAGE POPUP MODAL ===== */
.message-modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.7) translateY(-20px);
    transition: all 0.2s ease-in-out;
    position: relative;
    margin: auto;
}

.modal-overlay.show .message-modal-content {
    transform: scale(1) translateY(0);
}

.message-modal-header {
    padding: 25px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px 20px 0 0;
}

.message-modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.message-modal-body {
    padding: 25px;
    flex: 1;
    overflow-y: auto;
}

.message-info-section {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
    justify-content: center;
}

.message-info-section .topic-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
}

.message-info-section .player-name {
    color: #495057;
    font-weight: 600;
    font-size: 16px;
}

.message-content-section {
    font-size: 18px;
    line-height: 1.7;
    color: #333;
    text-align: justify;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
    border-left: 4px solid #667eea;
}

.message-modal-footer {
    padding: 25px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 15px;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 0 0 20px 20px;
}

.message-modal-footer .btn {
    padding: 15px 25px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    min-width: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.message-modal-footer .btn-secondary {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(23, 162, 184, 0.3);
}

.message-modal-footer .btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(23, 162, 184, 0.4);
}

.message-modal-footer .btn-primary {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.message-modal-footer .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease-in-out;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.7);
    transition: transform 0.2s ease-in-out;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background: #f8f9fa;
}

.modal-body {
    padding: 25px;
}

.modal-body input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 15px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.modal-body input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.3s;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    color: #667eea;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e9ecef;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-content p {
    font-size: 16px;
    font-weight: 500;
}

/* ===== ERROR MESSAGE ===== */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px 20px;
    border-radius: 10px;
    margin: 20px 0;
    border: 1px solid #f5c6cb;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.error-message::before {
    content: "⚠️";
    font-size: 18px;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    .app-container {
        max-width: 100%;
        border-radius: 15px;
        margin: 0;
    }
    
    .app-header {
        padding: 15px;
    }
    
    .app-header h1 {
        font-size: 22px;
    }
    
    .app-header p {
        font-size: 13px;
    }
    
    .api-config {
        padding: 15px;
    }
    
    .input-section {
        padding: 15px;
    }
    
    .input-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .input-row label {
        min-width: auto;
        font-size: 14px;
        font-weight: 600;
    }
    
    .input-with-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .topic-select, .player-select,
    .topic-input, .player-input {
        min-width: auto;
        max-width: 100%;
        width: 100%;
        padding: 15px;
        font-size: 16px;
    }
    
    .add-btn {
        width: 50px;
        height: 50px;
        font-size: 24px;
        align-self: center;
    }
    
    .generate-button {
        padding: 15px 30px;
        font-size: 16px;
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
    
    .message-display {
        padding: 15px;
    }
    
    .generated-message {
        padding: 20px;
    }
    
    .copy-btn {
        padding: 15px 25px;
        font-size: 16px;
        min-width: 120px;
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
    }
    
    .saved-items {
        justify-content: center;
        gap: 10px;
    }
    
    .saved-item {
        padding: 8px 15px;
        font-size: 14px;
    }
    
    .modal-content {
        margin: 10px;
        width: 95%;
        max-width: 400px;
    }
    
    .message-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        text-align: center;
    }
    
    .message-info {
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 2px;
    }
    
    .app-container {
        border-radius: 10px;
        min-height: 100vh;
    }
    
    .app-header {
        padding: 12px;
    }
    
    .app-header h1 {
        font-size: 20px;
    }
    
    .app-header p {
        font-size: 12px;
    }
    
    .config-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .config-row label {
        min-width: auto;
        font-size: 13px;
    }
    
    .config-row input {
        padding: 12px;
        font-size: 16px;
    }
    
    .input-section {
        padding: 12px;
    }
    
    .management-section {
        margin-bottom: 20px;
    }
    
    .topic-select, .player-select,
    .topic-input, .player-input {
        padding: 18px;
        font-size: 16px;
        border-radius: 12px;
    }
    
    .add-btn {
        width: 55px;
        height: 55px;
        font-size: 26px;
        border-radius: 15px;
    }
    
    .generate-button {
        padding: 18px 35px;
        font-size: 18px;
        border-radius: 15px;
    }
    
    .placeholder-icon {
        font-size: 36px;
    }
    
    .placeholder-message p {
        font-size: 14px;
    }
    
    .generated-message {
        padding: 15px;
        border-radius: 12px;
    }
    
    .copy-btn {
        padding: 18px 30px;
        font-size: 18px;
        border-radius: 15px;
        min-width: 150px;
    }
    
    .message-content {
        font-size: 15px;
        line-height: 1.7;
    }
    
    .saved-item {
        padding: 10px 18px;
        font-size: 15px;
        border-radius: 25px;
    }
    
    .edit-btn, .delete-btn {
        font-size: 16px;
        padding: 4px 8px;
    }
    
    .modal-body input {
        padding: 15px;
        font-size: 16px;
    }
}