/* The Phi Kappa Mu Living Memory Plugin Styles - Enhanced */

/* Base Styles */
.pkm-memory-threads {
    margin: 20px 0;
}

.pkm-memory-thread {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    background: #f9f9f9;
    transition: box-shadow 0.3s ease;
}

.pkm-memory-thread:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.pkm-memory-thread h3 {
    margin-top: 0;
    color: #2c3e50;
}

.pkm-memory-thread h3 a {
    text-decoration: none;
    color: #2c3e50;
}

.pkm-memory-thread h3 a:hover {
    color: #3498db;
}

.pkm-thread-thumbnail {
    float: right;
    margin-left: 15px;
    margin-bottom: 15px;
    max-width: 150px;
}

.pkm-thread-thumbnail img {
    border-radius: 5px;
    width: 100%;
    height: auto;
}

.pkm-thread-meta {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
}

.pkm-thread-meta .pkm-author,
.pkm-thread-meta .pkm-date {
    margin-right: 15px;
}

.pkm-contribution-count {
    margin-top: 10px;
    font-size: 12px;
    color: #888;
}

/* Frontend Thread Creation Form */
.pkm-create-thread-form-container {
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 30px;
    margin: 20px 0;
    max-width: 800px;
}

.pkm-login-required {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 20px;
    border-radius: 5px;
    text-align: center;
}

.pkm-login-required a.button {
    background: #007cba;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 3px;
    display: inline-block;
    margin-top: 10px;
}

.pkm-form-group {
    margin-bottom: 20px;
}

.pkm-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.pkm-form-group input[type="text"],
.pkm-form-group input[type="url"],
.pkm-form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 5px;
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

.pkm-form-group input[type="text"]:focus,
.pkm-form-group input[type="url"]:focus,
.pkm-form-group textarea:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.pkm-form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.pkm-form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

/* Media Upload Buttons */
.pkm-media-options {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.pkm-media-options .button {
    background: #f7f7f7;
    border: 1px solid #ccc;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.3s ease;
}

.pkm-media-options .button:hover {
    background: #e7e7e7;
}

.pkm-media-options .button.active {
    background: #007cba;
    color: white;
    border-color: #005a87;
}

/* Media Preview */
#pkm-media-preview {
    margin-top: 15px;
    padding: 15px;
    border: 2px dashed #ccc;
    border-radius: 5px;
    text-align: center;
    min-height: 50px;
    background: #fafafa;
}

#pkm-media-preview.has-media {
    border-color: #007cba;
    background: #f0f8ff;
}

#pkm-media-preview img,
#pkm-media-preview video {
    max-width: 100%;
    max-height: 200px;
    border-radius: 5px;
    margin: 10px 0;
}

.pkm-media-item {
    display: inline-block;
    position: relative;
    margin: 10px;
}

.pkm-remove-media {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    line-height: 1;
}

/* Form Actions */
.pkm-form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.pkm-submit-btn {
    background: #007cba;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.3s ease;
    position: relative;
}

.pkm-submit-btn:hover {
    background: #005a87;
}

.pkm-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.pkm-submit-loading {
    display: none;
}

.pkm-submit-btn.loading .pkm-submit-text {
    display: none;
}

.pkm-submit-btn.loading .pkm-submit-loading {
    display: inline;
}

/* Messages */
#pkm-thread-messages {
    margin-bottom: 20px;
}

.pkm-message {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.pkm-message.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.pkm-message.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.pkm-message.info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Preview Container */
.pkm-preview-container {
    margin-top: 30px;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #f9f9f9;
}

.pkm-preview-content {
    margin-bottom: 15px;
}

/* Contributions Section */
.pkm-contributions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #eee;
}

.pkm-contribution {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 15px;
}

.pkm-contribution-meta {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}

.pkm-contribution-content {
    line-height: 1.6;
}

.pkm-add-contribution {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 20px;
    margin-top: 20px;
}

.pkm-add-contribution h4 {
    margin-top: 0;
    color: #495057;
}

.pkm-add-contribution textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 3px;
    font-family: inherit;
    margin-bottom: 15px;
    box-sizing: border-box;
}

.pkm-add-contribution button {
    background: #007cba;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 3px;
    cursor: pointer;
}

.pkm-add-contribution button:hover {
    background: #005a87;
}

/* Thread Link Display */
.pkm-thread-link {
    margin: 20px 0;
    padding: 15px;
    background: #e8f4f8;
    border: 1px solid #bee5eb;
    border-radius: 5px;
}

.pkm-thread-link h4 {
    margin-top: 0;
    color: #0c5460;
}

.pkm-thread-link a {
    color: #007cba;
    word-break: break-all;
}

/* Admin Styles */
.pkm-stats {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
    margin: 20px 0;
}

.pkm-actions {
    margin: 20px 0;
}

.pkm-actions .button {
    margin-right: 10px;
}

.pkm-frontend-info {
    background: #f0f8ff;
    border: 1px solid #bee5eb;
    border-radius: 4px;
    padding: 20px;
    margin: 20px 0;
}

.pkm-frontend-info code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
}

/* Character Counter */
.pkm-char-counter {
    font-size: 12px;
    color: #666;
    text-align: right;
    margin-top: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .pkm-create-thread-form-container {
        padding: 20px;
        margin: 10px 0;
    }

    .pkm-memory-thread,
    .pkm-contribution,
    .pkm-add-contribution {
        padding: 15px;
    }

    .pkm-thread-thumbnail {
        float: none;
        margin: 0 0 15px 0;
        max-width: 100%;
    }

    .pkm-form-actions {
        flex-direction: column;
    }

    .pkm-form-actions .button {
        width: 100%;
        text-align: center;
    }

    .pkm-media-options {
        justify-content: center;
    }

    .pkm-add-contribution textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

@media (max-width: 480px) {
    .pkm-create-thread-form-container {
        padding: 15px;
    }

    .pkm-media-options .button {
        font-size: 12px;
        padding: 6px 12px;
    }
}