/**
 * SocialPilot Meta Box Styles
 *
 * @package SocialPilot
 * @since 1.0.0
 */


/* Main Container with two-column layout */

.socialpilot-metabox {
    padding: 15px;
    margin: 10px 0;
    background: #fff;
    border: 1px solid #e5e5e5;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

.postbox {
    border: none !important;
    background: #f8f9fa !important;

}

/* Left Column Container */

.socialpilot-left-column {
    display: flex;
    flex-direction: column;
    background: #fff;
    padding: 15px 15px 0 15px;
    border-radius: 4px;
}


/* Right Column for Accounts */

.socialpilot-right-column {
    border-left: none;
    border-radius: 4px;
    background: #fff;
    padding: 15px;
}


/* Common Field Styles */

.socialpilot-field {
    margin-bottom: 20px;
}

.socialpilot-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #23282d;
}

.socialpilot-field .description {
    color: #666;
    font-style: italic;
    font-size: 13px;
    margin-top: 4px;
}


/* Form Controls */

.socialpilot-field input[type="text"],
.socialpilot-field input[type="url"],
.socialpilot-field textarea {
    width: 100%;
    max-width: 100%;
    padding: 8px;
    margin: 0;
    box-shadow: 0 0 0 transparent;
    border-radius: 4px;
    border: 1px solid #8c8f94;
    background-color: #fff;
    color: #2c3338;
    font-size: 14px;
    line-height: 1.4;
}

.socialpilot-field input[type="datetime-local"] {
    width: 200px;
    padding: 6px;
    border-radius: 4px;
    border: 1px solid #8c8f94;
}


/* Post Type Selection */

.post-type-radio {
    margin: 10px 0 15px;
}

.post-type-radio label {
    display: inline-block;
    margin-right: 20px;
    font-weight: normal;
}

.post-type-radio input[type="radio"] {
    margin-right: 5px;
}


/* Media Management */

.media-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin: 15px 0;
    min-height: 50px;
}

.media-item {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px;
    background: #fff;
}

.media-item img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 2px;
}

.media-placeholder {
    padding: 20px;
    text-align: center;
    border: 2px dashed #ddd;
    border-radius: 4px;
    color: #666;
}


/* Remove Buttons */

.remove-media,
.remove-thumbnail {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc3545;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.remove-media:hover,
.remove-thumbnail:hover {
    background: #c82333;
}


/* Article Thumbnail */

.thumbnail-preview {
    margin: 10px 0;
}

.thumbnail-container {
    position: relative;
    max-width: 150px;
}

.thumbnail-container img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
}


/* Account Selection */

.accounts-list {
    height: 100%;
    max-height: 900px;
    overflow-y: auto;
    border: none;
    padding: 0;
    border-radius: 4px;
    background: #fff;
}

.account-group {
    margin-bottom: 15px;
}

.account-group:last-child {
    margin-bottom: 0;
}

.account-group-header {
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}

.account-group-header h4 {
    margin: 0;
    color: #23282d;
    font-size: 14px;
}


/* Account Items */

.account-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
    margin-bottom: 4px;
}

.account-item:hover {
    background-color: #f8f9fa;
}

.account-item.account-disabled {
    opacity: 0.7;
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.account-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    flex: 1;
    cursor: pointer;
    font-weight: normal;
}

.account-disabled label {
    cursor: not-allowed;
}

.platform-logo {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.account-avatar {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.account-username {
    flex: 1;
    font-size: 13px;
}

.account-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: #666;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s;
}

.account-link:hover {
    color: #2271b1;
    background: #f0f0f1;
}

.account-link .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
}

.account-link:hover .dashicons {
    transform: translateY(-1px);
}


/* Schedule Post Button */

.schedule-post-container {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.socialpilot-metabox .button {
    margin: 5px 5px 5px 0;
}

.socialpilot-metabox .button .dashicons {
    vertical-align: middle;
    font-size: 16px;
    height: 16px;
    margin-top: -2px;
}

#schedule_post {
    display: block;
    width: auto;
    text-align: center;
    line-height: 24px;
    font-size: 14px;
    font-weight: 400;
    padding: 3px 16px;
    margin-left: 16px;
    background: #0f67ea !important;
    border-color: #0f67ea !important;
    color: #fff !important;
}

.socialpilot-field.mb-0 {
    margin-bottom: 0 !important;
}

/* Messages */

#socialpilot_messages {
    margin-top: 0;
    grid-column: 1 / -1;
    /* Span both columns */
}

.socialpilot-metabox .notice {
    margin: 5px 0 15px;
    padding: 8px 12px;
}

.wp-core-ui .button-secondary:focus,
.wp-core-ui .button.focus,
.wp-core-ui .button:focus {
    box-shadow: none !important;
}

/* Loading States */

.loading-accounts {
    text-align: center;
    padding: 20px;
    color: #666;
}


/* Responsive Adjustments */

@media screen and (max-width: 1200px) {
    .socialpilot-metabox {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .socialpilot-right-column {
        border-left: none;
        padding-left: 0;
        border-top: 1px solid #e5e5e5;
        padding-top: 20px;
    }

    .accounts-list {
        max-height: 400px;
    }
}

.socialpilot-logo-area {
    display: flex;
    align-items: center;
}

/**
 * SocialPilot Meta Box Styles
 *
 * @package SocialPilot
 * @since 1.0.0
 */


/* Main Container */

.socialpilot-metabox {
    padding: 0;
    margin: 10px 0;
    background: none;
    border: none;
    box-shadow: none;
}


/* Common Field Styles */

.socialpilot-field {
    margin-bottom: 24px !important;
}

.socialpilot-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #23282d;
}

.socialpilot-field .description {
    color: #666;
    font-style: italic;
    font-size: 13px;
    margin-top: 4px;
}


/* Form Controls */

.socialpilot-field input[type="text"],
.socialpilot-field input[type="url"],
.socialpilot-field textarea {
    width: 100%;
    max-width: 100%;
    padding: 8px;
    margin: 0;
    box-shadow: 0 0 0 transparent;
    border-radius: 4px;
    border: 1px solid #b7bcc466 !important;
    background-color: #f8f9fa;
    color: #2c3338;
    font-size: 14px;
    line-height: 1.4;
}

.socialpilot-field textarea:focus,
.socialpilot-field input[type="text"]:focus {
    background: #fff !important;
    box-shadow: 0px 2px 9px rgba(37, 50, 69, 0.15) !important;
    border-color: #89b9ff !important;
}

.socialpilot-field input[type="datetime-local"] {
    width: 200px;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid #0f67ea;
}

.socialpilot-field input[type="datetime-local"]:focus {
    border-color: #89b9ff !important;
    box-shadow: none !important;
}

/* Post Type Selection */

.post-type-radio {
    margin: 10px 0 0;
}

.post-type-radio label {
    display: inline-block;
    margin-right: 20px;
    font-weight: normal;
    margin-bottom: 0 !important;
}

.post-type-radio input[type="radio"] {
    margin-right: 5px;
}

.postbox-header {
    background: #fff !important;
    margin-bottom: 16px !important;
}

.postbox-header h2 {
    font-size: 18px !important;
    color: #1b1c1e !important;
}

/* Media Management */

.media-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 15px;
    margin: 15px 0;
    min-height: 130px;
    align-items: center;
    height: auto;
}

.media-item {
    position: relative;
    border: none;
    border-radius: 4px;
    padding: 5px;
    background: #F2F5F5;
}

.media-item img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 2px;
}

.media-placeholder {
    padding: 20px;
    text-align: center;
    border: 1px dashed #5f6166;
    border-radius: 4px;
    color: #666;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F2F5F5;
}


/* Remove Buttons */

.remove-media,
.remove-thumbnail {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #555;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.remove-media:hover,
.remove-thumbnail:hover {
    background: #555;
}


/* Article Thumbnail */

.thumbnail-preview {
    margin: 10px 0;
}

.thumbnail-container {
    position: relative;
    max-width: 150px;
    height: 150px;
}

.thumbnail-container img {
    width: 100%;
    height: 100%;
    border-radius: 4px;
    display: block;
    object-fit: contain;
    background: #F2F5F5;
}


/* Account Selection */

.accounts-list {
    max-height: 600px;
    overflow-y: auto;
    border: none !important;
    padding: 0;
    border-radius: 4px;
    background: #fff;
}

#generate_caption {
    border: none !important;
    background: none !important;
    padding: 0 !important;
    font-size: 14px !important;
}

#generate_caption:focus {
    border: none;
    outline: none !important;
    box-shadow: none !important;
}

.account-group {
    margin-bottom: 15px;
}

.account-group:last-child {
    margin-bottom: 0;
}

.account-group-header {
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}

.account-group-header h4 {
    margin: 0;
    color: #23282d;
    font-size: 14px;
}


/* Account Items */

.account-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.account-item:hover {
    background-color: #f8f9fa;
}

.account-checkbox {
    margin-top: 2px !important;
}

.account-item.account-disabled {
    opacity: 0.7;
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.account-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    flex: 1;
    cursor: pointer;
    font-weight: normal;
}

.account-disabled label {
    cursor: not-allowed;
}

.platform-logo {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.account-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.account-username {
    flex: 1;
    font-size: 13px;
    word-break: break-word;
}

.account-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: #666;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s;
}

.account-link:hover {
    color: #2271b1;
    background: #f0f0f1;
}

.account-link .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
}

.account-link:hover .dashicons {
    transform: translateY(-1px);
}


/* Buttons */

.socialpilot-metabox .button {
    margin: 5px 0 5px 0;
    float: right;
}

.socialpilot-metabox .button .dashicons {
    vertical-align: middle;
    font-size: 16px;
    height: 16px;
    margin-top: -2px;
}


/* Messages */

#socialpilot_messages {
    margin-top: 0;
}

.right-bar-label {
    margin-bottom: 16px !important;
    font-size: 16px;
    font-weight: 600;
}

.socialpilot-metabox .notice {
    margin: 5px 0 15px;
    padding: 2px 8px;
    border: none !important;
    box-shadow: none !important;
    border-radius: 4px;
}

.notice.notice-error {
    color: #c82333;
    border: 1px solid #eec5be !important;
}

.notice.notice-success {
    color: #008000;
    border: 1px solid #edf4ff !important;
}

/* Loading States */

.loading-accounts {
    text-align: center;
    padding: 20px;
    color: #666;
}

.post-type-fields {
    border-top: 1px solid #e5e5e5;
    padding-top: 24px;
    margin-top: 20px;
}

.border-top {
    border-top: 1px solid #e5e5e5;
    padding-top: 24px;
}

#add_media {
    width: 140px;
}

#add_media,
#add_thumbnail {
    float: left;
}

/* Responsive Adjustments */

@media screen and (max-width: 782px) {
    .socialpilot-field input[type="datetime-local"] {
        width: 100%;
        max-width: 200px;
    }

    .media-preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }

    .account-item label {
        padding: 8px 0;
    }

    .post-type-radio label {
        display: block;
        margin-bottom: 10px;
    }
}